diff --git a/sdk/communication/azure-communication-identity/CHANGELOG.md b/sdk/communication/azure-communication-identity/CHANGELOG.md index cbe5dc3d14b3..28774e65f045 100644 --- a/sdk/communication/azure-communication-identity/CHANGELOG.md +++ b/sdk/communication/azure-communication-identity/CHANGELOG.md @@ -4,11 +4,6 @@ ### Added - Added CommunicationIdentityClient (originally was part of the azure.communication.administration package). -- Added ability to create a user and issue token for it at the same time. - -### Breaking -- CommunicationIdentityClient.revoke_tokens now revoke all the currently issued tokens instead of revoking tokens issued prior to a given time. -- CommunicationIdentityClient.issue_tokens returns an instance of `azure.core.credentials.AccessToken` instead of `CommunicationUserToken`. [read_me]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/communication/azure-communication-identity/README.md diff --git a/sdk/communication/azure-communication-identity/README.md b/sdk/communication/azure-communication-identity/README.md index e1193e980f06..bce44c94e482 100644 --- a/sdk/communication/azure-communication-identity/README.md +++ b/sdk/communication/azure-communication-identity/README.md @@ -36,58 +36,19 @@ endpoint = os.getenv('AZURE_COMMUNICATION_SERVICE_ENDPOINT') # To use Azure Active Directory Authentication (DefaultAzureCredential) make sure to have # AZURE_TENANT_ID, AZURE_CLIENT_ID and AZURE_CLIENT_SECRET as env variables. -identity_client_managed_identity = CommunicationIdentityClient(endpoint, DefaultAzureCredential()) +identity_client_managed_identity = CommunicationIdentityClient.(endpoint, DefaultAzureCredential()) #You can also authenticate using your connection string identity_client = CommunicationIdentityClient.from_connection_string(connection_str) ``` -## Examples +# Examples The following section provides several code snippets covering some of the most common Azure Communication Services tasks, including: -### Creating a new user +[Create/delete Azure Communication Service identities][identitysamples] -Use the `create_user` method to create a new user. -```python -user = identity_client.create_user() -print("User created with id:" + user.identifier) -``` - -Alternatively, use the `create_user_with_token` method to create a new user and issue a token for it.\ -For this option, a list of `CommunicationTokenScope` must be defined (see "Issuing an access token" for more information) - -```python -user, tokenresponse = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) -print("User id:" + user.identifier) -print("Token issued with value: " + tokenresponse.token) -``` - -### Issuing or Refreshing an access token for a user - -Use the `issue_token` method to issue or refresh a scoped access token for the user. \ -Pass in the user object as a parameter, and a list of `CommunicationTokenScope`. Scope options are: -- `CHAT` (Chat) -- `VOIP` (VoIP) - -```python -tokenresponse = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) -print("Token issued with value: " + tokenresponse.token) -``` - -### Revoking a user's access tokens - -Use `revoke_tokens` to revoke all access tokens for a user. Pass in the user object as a parameter -```python -identity_client.revoke_tokens(user) -``` - -### Deleting a user - -Use the `delete_user` method to delete a user. Pass in the user object as a parameter -```python -identity_client.delete_user(user) -``` +[Create/revoke scoped user access tokens][identitysamples] # Troubleshooting The Azure Communication Service Identity client will raise exceptions defined in [Azure Core][azure_core]. @@ -112,4 +73,5 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. +[identitysamples]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/communication/azure-communication-identity/samples/identity_samples.py [azure_core]: https://github.com/Azure/azure-sdk-for-python/blob/master/sdk/core/azure-core/README.md diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/__init__.py b/sdk/communication/azure-communication-identity/azure/communication/identity/__init__.py index 1921a8e3e522..77579e0b4d62 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/__init__.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/__init__.py @@ -7,16 +7,19 @@ from ._communication_identity_client import CommunicationIdentityClient from ._generated.models import ( - CommunicationTokenScope + CommunicationTokenRequest, + CommunicationIdentityToken ) from ._shared.models import CommunicationUserIdentifier + __all__ = [ 'CommunicationIdentityClient', # from _identity - 'CommunicationTokenScope', + 'CommunicationTokenRequest', + 'CommunicationIdentityToken', # from _shared 'CommunicationUserIdentifier' diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py index 595762303739..bb3cb57fe258 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_communication_identity_client.py @@ -5,10 +5,10 @@ # ------------------------------------ from azure.core.tracing.decorator import distributed_trace -from azure.core.credentials import AccessToken from ._generated._communication_identity_client\ import CommunicationIdentityClient as CommunicationIdentityClientGen +from ._generated.models import CommunicationIdentityToken from ._shared.utils import parse_connection_str, get_authentication_policy from ._shared.models import CommunicationUserIdentifier from ._version import SDK_MONIKER @@ -62,7 +62,7 @@ def from_connection_string( :param str conn_str: A connection string to an Azure Communication Service resource. :returns: Instance of CommunicationIdentityClient. - :rtype: ~azure.communication.identity.CommunicationIdentityClient + :rtype: ~azure.communication.CommunicationIdentityClient .. admonition:: Example: @@ -82,32 +82,11 @@ def create_user(self, **kwargs): # type: (...) -> CommunicationUserIdentifier """create a single Communication user - :return: CommunicationUserIdentifier - :rtype: ~azure.communication.identity.CommunicationUserIdentifier + return: CommunicationUserIdentifier + rtype: ~azure.communication.identity.CommunicationUserIdentifier """ return self._identity_service_client.communication_identity.create( - cls=lambda pr, u, e: CommunicationUserIdentifier(u.identity.id), - **kwargs) - - @distributed_trace - def create_user_with_token( - self, - scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]] - **kwargs # type: Any - ): - # type: (...) -> Tuple[CommunicationUserIdentifier, AccessToken] - """create a single Communication user with an identity token. - :param scopes: - List of scopes to be added to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] - :return: A tuple of a CommunicationUserIdentifier and a AccessToken. - :rtype: - tuple of (~azure.communication.identity.CommunicationUserIdentifier, ~azure.core.credentials.AccessToken) - """ - return self._identity_service_client.communication_identity.create( - cls=lambda pr, u, e: (CommunicationUserIdentifier(u.identity.id), - AccessToken(u.access_token.token, u.access_token.expires_on)), - create_token_with_scopes=scopes, + cls=lambda pr, u, e: CommunicationUserIdentifier(u.id), **kwargs) @distributed_trace @@ -132,30 +111,30 @@ def delete_user( def issue_token( self, user, # type: CommunicationUserIdentifier - scopes, # List[Union[str, "_model.CommunicationTokenScope"]] + scopes, # type: List[str] **kwargs # type: Any ): - # type: (...) -> AccessToken + # type: (...) -> CommunicationIdentityToken """Generates a new token for an identity. :param user: Azure Communication User :type user: ~azure.communication.identity.CommunicationUserIdentifier :param scopes: List of scopes to be added to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] - :return: AccessToken - :rtype: ~azure.core.credentials.AccessToken + :type scopes: list[str] + :return: CommunicationIdentityToken + :rtype: ~azure.communication.identity.CommunicationIdentityToken """ - return self._identity_service_client.communication_identity.issue_access_token( + return self._identity_service_client.communication_identity.issue_token( user.identifier, scopes, - cls=lambda pr, u, e: AccessToken(u.token, u.expires_on), **kwargs) @distributed_trace def revoke_tokens( self, user, # type: CommunicationUserIdentifier + issued_before=None, # type: Optional[datetime.datetime] **kwargs # type: Any ): # type: (...) -> None @@ -163,9 +142,12 @@ def revoke_tokens( :param user: Azure Communication User. :type user: ~azure.communication.identity.CommunicationUserIdentifier. + :param issued_before: All tokens that are issued prior to this time should get revoked. + :type issued_before: ~datetime.datetime. :return: None :rtype: None """ - return self._identity_service_client.communication_identity.revoke_access_tokens( + return self._identity_service_client.communication_identity.update( user.identifier if user else None, + tokens_valid_from=issued_before, **kwargs) diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_communication_identity_client.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_communication_identity_client.py index 4e970ee1869a..9e20523636c1 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_communication_identity_client.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_communication_identity_client.py @@ -25,7 +25,7 @@ class CommunicationIdentityClient(object): :ivar communication_identity: CommunicationIdentityOperations operations :vartype communication_identity: azure.communication.identity.operations.CommunicationIdentityOperations - :param endpoint: The communication resource, for example https://my-resource.communication.azure.com. + :param endpoint: Auth and Identity endpoint. :type endpoint: str """ @@ -41,7 +41,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.communication_identity = CommunicationIdentityOperations( diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_configuration.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_configuration.py index 68363ff6515f..079f98f2ffd0 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_configuration.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/_configuration.py @@ -23,7 +23,7 @@ class CommunicationIdentityClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: The communication resource, for example https://my-resource.communication.azure.com. + :param endpoint: Auth and Identity endpoint. :type endpoint: str """ @@ -38,7 +38,7 @@ def __init__( super(CommunicationIdentityClientConfiguration, self).__init__(**kwargs) self.endpoint = endpoint - self.api_version = "2021-03-07" + self.api_version = "2020-07-20-preview2" kwargs.setdefault('sdk_moniker', 'communicationidentityclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_communication_identity_client.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_communication_identity_client.py index 99c76d0c7fc7..998d60b4c35b 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_communication_identity_client.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_communication_identity_client.py @@ -21,7 +21,7 @@ class CommunicationIdentityClient(object): :ivar communication_identity: CommunicationIdentityOperations operations :vartype communication_identity: azure.communication.identity.aio.operations.CommunicationIdentityOperations - :param endpoint: The communication resource, for example https://my-resource.communication.azure.com. + :param endpoint: Auth and Identity endpoint. :type endpoint: str """ @@ -36,7 +36,6 @@ def __init__( client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) self.communication_identity = CommunicationIdentityOperations( diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_configuration.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_configuration.py index ffd8616506db..4b91da974fe0 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_configuration.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/_configuration.py @@ -19,7 +19,7 @@ class CommunicationIdentityClientConfiguration(Configuration): Note that all parameters used to create this instance are saved as instance attributes. - :param endpoint: The communication resource, for example https://my-resource.communication.azure.com. + :param endpoint: Auth and Identity endpoint. :type endpoint: str """ @@ -33,7 +33,7 @@ def __init__( super(CommunicationIdentityClientConfiguration, self).__init__(**kwargs) self.endpoint = endpoint - self.api_version = "2021-03-07" + self.api_version = "2020-07-20-preview2" kwargs.setdefault('sdk_moniker', 'communicationidentityclient/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/operations/_communication_identity_operations.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/operations/_communication_identity_operations.py index 804305f349e2..b1143a98ca01 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/operations/_communication_identity_operations.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/aio/operations/_communication_identity_operations.py @@ -5,7 +5,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import datetime +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -41,29 +42,23 @@ def __init__(self, client, config, serializer, deserializer) -> None: async def create( self, - create_token_with_scopes: Optional[List[Union[str, "_models.CommunicationTokenScope"]]] = None, **kwargs - ) -> "_models.CommunicationIdentityAccessTokenResult": + ) -> "_models.CommunicationIdentity": """Create a new identity. Create a new identity. - :param create_token_with_scopes: Also create access token for the created identity. - :type create_token_with_scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationIdentityAccessTokenResult, or the result of cls(response) - :rtype: ~azure.communication.identity.models.CommunicationIdentityAccessTokenResult + :return: CommunicationIdentity, or the result of cls(response) + :rtype: ~azure.communication.identity.models.CommunicationIdentity :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentityAccessTokenResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentity"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - _body = _models.CommunicationIdentityCreateRequest(create_token_with_scopes=create_token_with_scopes) - api_version = "2021-03-07" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2020-07-20-preview2" accept = "application/json" # Construct URL @@ -79,25 +74,17 @@ async def create( # 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') - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'CommunicationIdentityCreateRequest') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) - deserialized = self._deserialize('CommunicationIdentityAccessTokenResult', pipeline_response) + deserialized = self._deserialize('CommunicationIdentity', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -110,9 +97,9 @@ async def delete( id: str, **kwargs ) -> None: - """Delete the identity, revoke all tokens for the identity and delete all associated data. + """Delete the identity, revoke all tokens of the identity and delete all associated data. - Delete the identity, revoke all tokens for the identity and delete all associated data. + Delete the identity, revoke all tokens of the identity and delete all associated data. :param id: Identifier of the identity to be deleted. :type id: str @@ -126,8 +113,7 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-07" - accept = "application/json" + api_version = "2020-07-20-preview2" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -143,7 +129,6 @@ async def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) @@ -151,25 +136,27 @@ async def delete( if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/identities/{id}'} # type: ignore - async def revoke_access_tokens( + async def update( self, id: str, + tokens_valid_from: Optional[datetime.datetime] = None, **kwargs ) -> None: - """Revoke all access tokens for the specific identity. + """Update an Identity. - Revoke all access tokens for the specific identity. + Update an Identity. :param id: Identifier of the identity. :type id: str + :param tokens_valid_from: All tokens that are issued prior to this time will be revoked. + :type tokens_valid_from: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -180,11 +167,13 @@ async def revoke_access_tokens( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-07" - accept = "application/json" + + _body = _models.CommunicationIdentityUpdateRequest(tokens_valid_from=tokens_valid_from) + api_version = "2020-07-20-preview2" + content_type = kwargs.pop("content_type", "application/merge-patch+json") # Construct URL - url = self.revoke_access_tokens.metadata['url'] # type: ignore + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), 'id': self._serialize.url("id", id, 'str'), @@ -197,54 +186,56 @@ async def revoke_access_tokens( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - request = self._client.post(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + 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 if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) - revoke_access_tokens.metadata = {'url': '/identities/{id}/:revokeAccessTokens'} # type: ignore + update.metadata = {'url': '/identities/{id}'} # type: ignore - async def issue_access_token( + async def issue_token( self, id: str, - scopes: List[Union[str, "_models.CommunicationTokenScope"]], + scopes: List[str], **kwargs - ) -> "_models.CommunicationIdentityAccessToken": - """Issue a new token for an identity. + ) -> "_models.CommunicationIdentityToken": + """Generate a new token for an identity. - Issue a new token for an identity. + Generate a new token for an identity. :param id: Identifier of the identity to issue token for. :type id: str :param scopes: List of scopes attached to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] + :type scopes: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationIdentityAccessToken, or the result of cls(response) - :rtype: ~azure.communication.identity.models.CommunicationIdentityAccessToken + :return: CommunicationIdentityToken, or the result of cls(response) + :rtype: ~azure.communication.identity.models.CommunicationIdentityToken :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentityAccessToken"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentityToken"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - _body = _models.CommunicationIdentityAccessTokenRequest(scopes=scopes) - api_version = "2021-03-07" + _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_access_token.metadata['url'] # type: ignore + url = self.issue_token.metadata['url'] # type: ignore path_format_arguments = { 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), 'id': self._serialize.url("id", id, 'str'), @@ -261,7 +252,7 @@ async def issue_access_token( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'CommunicationIdentityAccessTokenRequest') + 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) @@ -269,13 +260,12 @@ async def issue_access_token( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) - deserialized = self._deserialize('CommunicationIdentityAccessToken', pipeline_response) + deserialized = self._deserialize('CommunicationIdentityToken', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - issue_access_token.metadata = {'url': '/identities/{id}/:issueAccessToken'} # type: ignore + issue_token.metadata = {'url': '/identities/{id}/token'} # type: ignore diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/__init__.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/__init__.py index c5df5a066788..05dd3d4b6aab 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/__init__.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/__init__.py @@ -7,33 +7,19 @@ # -------------------------------------------------------------------------- try: - from ._models_py3 import CommunicationError - from ._models_py3 import CommunicationErrorResponse from ._models_py3 import CommunicationIdentity - from ._models_py3 import CommunicationIdentityAccessToken - from ._models_py3 import CommunicationIdentityAccessTokenRequest - from ._models_py3 import CommunicationIdentityAccessTokenResult - from ._models_py3 import CommunicationIdentityCreateRequest + from ._models_py3 import CommunicationIdentityToken + from ._models_py3 import CommunicationIdentityUpdateRequest + from ._models_py3 import CommunicationTokenRequest except (SyntaxError, ImportError): - from ._models import CommunicationError # type: ignore - from ._models import CommunicationErrorResponse # type: ignore from ._models import CommunicationIdentity # type: ignore - from ._models import CommunicationIdentityAccessToken # type: ignore - from ._models import CommunicationIdentityAccessTokenRequest # type: ignore - from ._models import CommunicationIdentityAccessTokenResult # type: ignore - from ._models import CommunicationIdentityCreateRequest # type: ignore - -from ._communication_identity_client_enums import ( - CommunicationTokenScope, -) + from ._models import CommunicationIdentityToken # type: ignore + from ._models import CommunicationIdentityUpdateRequest # type: ignore + from ._models import CommunicationTokenRequest # type: ignore __all__ = [ - 'CommunicationError', - 'CommunicationErrorResponse', 'CommunicationIdentity', - 'CommunicationIdentityAccessToken', - 'CommunicationIdentityAccessTokenRequest', - 'CommunicationIdentityAccessTokenResult', - 'CommunicationIdentityCreateRequest', - 'CommunicationTokenScope', + 'CommunicationIdentityToken', + 'CommunicationIdentityUpdateRequest', + 'CommunicationTokenRequest', ] diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_communication_identity_client_enums.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_communication_identity_client_enums.py deleted file mode 100644 index fb650aac3d10..000000000000 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_communication_identity_client_enums.py +++ /dev/null @@ -1,34 +0,0 @@ -# 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, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class CommunicationTokenScope(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """List of scopes for an access token. - """ - - CHAT = "chat" - VOIP = "voip" diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models.py index b69cad65181d..ce2106c91807 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models.py @@ -6,81 +6,9 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from azure.core.exceptions import HttpResponseError import msrest.serialization -class CommunicationError(msrest.serialization.Model): - """The Communication Services error. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. The error code. - :type code: str - :param message: Required. The error message. - :type message: str - :ivar target: The error target. - :vartype target: str - :ivar details: Further details about specific errors that led to this error. - :vartype details: list[~azure.communication.identity.models.CommunicationError] - :param inner_error: The Communication Services error. - :type inner_error: ~azure.communication.identity.models.CommunicationError - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CommunicationError]'}, - 'inner_error': {'key': 'innerError', 'type': 'CommunicationError'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunicationError, self).__init__(**kwargs) - self.code = kwargs['code'] - self.message = kwargs['message'] - self.target = None - self.details = None - self.inner_error = kwargs.get('inner_error', None) - - -class CommunicationErrorResponse(msrest.serialization.Model): - """The Communication Services error. - - All required parameters must be populated in order to send to Azure. - - :param error: Required. The Communication Services error. - :type error: ~azure.communication.identity.models.CommunicationError - """ - - _validation = { - 'error': {'required': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CommunicationError'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunicationErrorResponse, self).__init__(**kwargs) - self.error = kwargs['error'] - - class CommunicationIdentity(msrest.serialization.Model): """A communication identity. @@ -106,23 +34,27 @@ def __init__( self.id = kwargs['id'] -class CommunicationIdentityAccessToken(msrest.serialization.Model): - """An access token. +class CommunicationIdentityToken(msrest.serialization.Model): + """CommunicationIdentityToken. All required parameters must be populated in order to send to Azure. - :param token: Required. The access token issued for the identity. + :param id: Required. Identifier of the identity owning the token. + :type id: str + :param token: Required. The token issued for the identity. :type token: str :param expires_on: Required. The expiry time of the token. :type expires_on: ~datetime.datetime """ _validation = { + 'id': {'required': True}, 'token': {'required': True}, 'expires_on': {'required': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, 'token': {'key': 'token', 'type': 'str'}, 'expires_on': {'key': 'expiresOn', 'type': 'iso-8601'}, } @@ -131,80 +63,51 @@ def __init__( self, **kwargs ): - super(CommunicationIdentityAccessToken, self).__init__(**kwargs) + super(CommunicationIdentityToken, self).__init__(**kwargs) + self.id = kwargs['id'] self.token = kwargs['token'] self.expires_on = kwargs['expires_on'] -class CommunicationIdentityAccessTokenRequest(msrest.serialization.Model): - """CommunicationIdentityAccessTokenRequest. - - All required parameters must be populated in order to send to Azure. +class CommunicationIdentityUpdateRequest(msrest.serialization.Model): + """CommunicationIdentityUpdateRequest. - :param scopes: Required. List of scopes attached to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] + :param tokens_valid_from: All tokens that are issued prior to this time will be revoked. + :type tokens_valid_from: ~datetime.datetime """ - _validation = { - 'scopes': {'required': True}, - } - _attribute_map = { - 'scopes': {'key': 'scopes', 'type': '[str]'}, + 'tokens_valid_from': {'key': 'tokensValidFrom', 'type': 'iso-8601'}, } def __init__( self, **kwargs ): - super(CommunicationIdentityAccessTokenRequest, self).__init__(**kwargs) - self.scopes = kwargs['scopes'] + super(CommunicationIdentityUpdateRequest, self).__init__(**kwargs) + self.tokens_valid_from = kwargs.get('tokens_valid_from', None) -class CommunicationIdentityAccessTokenResult(msrest.serialization.Model): - """A communication identity with access token. +class CommunicationTokenRequest(msrest.serialization.Model): + """CommunicationTokenRequest. All required parameters must be populated in order to send to Azure. - :param identity: Required. A communication identity. - :type identity: ~azure.communication.identity.models.CommunicationIdentity - :param access_token: An access token. - :type access_token: ~azure.communication.identity.models.CommunicationIdentityAccessToken + :param scopes: Required. List of scopes attached to the token. + :type scopes: list[str] """ _validation = { - 'identity': {'required': True}, - } - - _attribute_map = { - 'identity': {'key': 'identity', 'type': 'CommunicationIdentity'}, - 'access_token': {'key': 'accessToken', 'type': 'CommunicationIdentityAccessToken'}, + 'scopes': {'required': True}, } - def __init__( - self, - **kwargs - ): - super(CommunicationIdentityAccessTokenResult, self).__init__(**kwargs) - self.identity = kwargs['identity'] - self.access_token = kwargs.get('access_token', None) - - -class CommunicationIdentityCreateRequest(msrest.serialization.Model): - """CommunicationIdentityCreateRequest. - - :param create_token_with_scopes: Also create access token for the created identity. - :type create_token_with_scopes: list[str or - ~azure.communication.identity.models.CommunicationTokenScope] - """ - _attribute_map = { - 'create_token_with_scopes': {'key': 'createTokenWithScopes', 'type': '[str]'}, + 'scopes': {'key': 'scopes', 'type': '[str]'}, } def __init__( self, **kwargs ): - super(CommunicationIdentityCreateRequest, self).__init__(**kwargs) - self.create_token_with_scopes = kwargs.get('create_token_with_scopes', None) + super(CommunicationTokenRequest, self).__init__(**kwargs) + self.scopes = kwargs['scopes'] diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models_py3.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models_py3.py index 6cd91adc9de6..ba3988b1589a 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models_py3.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/models/_models_py3.py @@ -7,89 +7,11 @@ # -------------------------------------------------------------------------- import datetime -from typing import List, Optional, Union +from typing import List, Optional -from azure.core.exceptions import HttpResponseError import msrest.serialization -class CommunicationError(msrest.serialization.Model): - """The Communication Services error. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. The error code. - :type code: str - :param message: Required. The error message. - :type message: str - :ivar target: The error target. - :vartype target: str - :ivar details: Further details about specific errors that led to this error. - :vartype details: list[~azure.communication.identity.models.CommunicationError] - :param inner_error: The Communication Services error. - :type inner_error: ~azure.communication.identity.models.CommunicationError - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CommunicationError]'}, - 'inner_error': {'key': 'innerError', 'type': 'CommunicationError'}, - } - - def __init__( - self, - *, - code: str, - message: str, - inner_error: Optional["CommunicationError"] = None, - **kwargs - ): - super(CommunicationError, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = None - self.details = None - self.inner_error = inner_error - - -class CommunicationErrorResponse(msrest.serialization.Model): - """The Communication Services error. - - All required parameters must be populated in order to send to Azure. - - :param error: Required. The Communication Services error. - :type error: ~azure.communication.identity.models.CommunicationError - """ - - _validation = { - 'error': {'required': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CommunicationError'}, - } - - def __init__( - self, - *, - error: "CommunicationError", - **kwargs - ): - super(CommunicationErrorResponse, self).__init__(**kwargs) - self.error = error - - class CommunicationIdentity(msrest.serialization.Model): """A communication identity. @@ -117,23 +39,27 @@ def __init__( self.id = id -class CommunicationIdentityAccessToken(msrest.serialization.Model): - """An access token. +class CommunicationIdentityToken(msrest.serialization.Model): + """CommunicationIdentityToken. All required parameters must be populated in order to send to Azure. - :param token: Required. The access token issued for the identity. + :param id: Required. Identifier of the identity owning the token. + :type id: str + :param token: Required. The token issued for the identity. :type token: str :param expires_on: Required. The expiry time of the token. :type expires_on: ~datetime.datetime """ _validation = { + 'id': {'required': True}, 'token': {'required': True}, 'expires_on': {'required': True}, } _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, 'token': {'key': 'token', 'type': 'str'}, 'expires_on': {'key': 'expiresOn', 'type': 'iso-8601'}, } @@ -141,91 +67,60 @@ class CommunicationIdentityAccessToken(msrest.serialization.Model): def __init__( self, *, + id: str, token: str, expires_on: datetime.datetime, **kwargs ): - super(CommunicationIdentityAccessToken, self).__init__(**kwargs) + super(CommunicationIdentityToken, self).__init__(**kwargs) + self.id = id self.token = token self.expires_on = expires_on -class CommunicationIdentityAccessTokenRequest(msrest.serialization.Model): - """CommunicationIdentityAccessTokenRequest. +class CommunicationIdentityUpdateRequest(msrest.serialization.Model): + """CommunicationIdentityUpdateRequest. - All required parameters must be populated in order to send to Azure. - - :param scopes: Required. List of scopes attached to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] + :param tokens_valid_from: All tokens that are issued prior to this time will be revoked. + :type tokens_valid_from: ~datetime.datetime """ - _validation = { - 'scopes': {'required': True}, - } - _attribute_map = { - 'scopes': {'key': 'scopes', 'type': '[str]'}, + 'tokens_valid_from': {'key': 'tokensValidFrom', 'type': 'iso-8601'}, } def __init__( self, *, - scopes: List[Union[str, "CommunicationTokenScope"]], + tokens_valid_from: Optional[datetime.datetime] = None, **kwargs ): - super(CommunicationIdentityAccessTokenRequest, self).__init__(**kwargs) - self.scopes = scopes + super(CommunicationIdentityUpdateRequest, self).__init__(**kwargs) + self.tokens_valid_from = tokens_valid_from -class CommunicationIdentityAccessTokenResult(msrest.serialization.Model): - """A communication identity with access token. +class CommunicationTokenRequest(msrest.serialization.Model): + """CommunicationTokenRequest. All required parameters must be populated in order to send to Azure. - :param identity: Required. A communication identity. - :type identity: ~azure.communication.identity.models.CommunicationIdentity - :param access_token: An access token. - :type access_token: ~azure.communication.identity.models.CommunicationIdentityAccessToken + :param scopes: Required. List of scopes attached to the token. + :type scopes: list[str] """ _validation = { - 'identity': {'required': True}, + 'scopes': {'required': True}, } _attribute_map = { - 'identity': {'key': 'identity', 'type': 'CommunicationIdentity'}, - 'access_token': {'key': 'accessToken', 'type': 'CommunicationIdentityAccessToken'}, - } - - def __init__( - self, - *, - identity: "CommunicationIdentity", - access_token: Optional["CommunicationIdentityAccessToken"] = None, - **kwargs - ): - super(CommunicationIdentityAccessTokenResult, self).__init__(**kwargs) - self.identity = identity - self.access_token = access_token - - -class CommunicationIdentityCreateRequest(msrest.serialization.Model): - """CommunicationIdentityCreateRequest. - - :param create_token_with_scopes: Also create access token for the created identity. - :type create_token_with_scopes: list[str or - ~azure.communication.identity.models.CommunicationTokenScope] - """ - - _attribute_map = { - 'create_token_with_scopes': {'key': 'createTokenWithScopes', 'type': '[str]'}, + 'scopes': {'key': 'scopes', 'type': '[str]'}, } def __init__( self, *, - create_token_with_scopes: Optional[List[Union[str, "CommunicationTokenScope"]]] = None, + scopes: List[str], **kwargs ): - super(CommunicationIdentityCreateRequest, self).__init__(**kwargs) - self.create_token_with_scopes = create_token_with_scopes + super(CommunicationTokenRequest, self).__init__(**kwargs) + self.scopes = scopes diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/operations/_communication_identity_operations.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/operations/_communication_identity_operations.py index 507b932cb689..745b0e36a4f3 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/operations/_communication_identity_operations.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_generated/operations/_communication_identity_operations.py @@ -5,6 +5,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import datetime from typing import TYPE_CHECKING import warnings @@ -16,7 +17,7 @@ if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -45,30 +46,24 @@ def __init__(self, client, config, serializer, deserializer): def create( self, - create_token_with_scopes=None, # type: Optional[List[Union[str, "_models.CommunicationTokenScope"]]] **kwargs # type: Any ): - # type: (...) -> "_models.CommunicationIdentityAccessTokenResult" + # type: (...) -> "_models.CommunicationIdentity" """Create a new identity. Create a new identity. - :param create_token_with_scopes: Also create access token for the created identity. - :type create_token_with_scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationIdentityAccessTokenResult, or the result of cls(response) - :rtype: ~azure.communication.identity.models.CommunicationIdentityAccessTokenResult + :return: CommunicationIdentity, or the result of cls(response) + :rtype: ~azure.communication.identity.models.CommunicationIdentity :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentityAccessTokenResult"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentity"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - - _body = _models.CommunicationIdentityCreateRequest(create_token_with_scopes=create_token_with_scopes) - api_version = "2021-03-07" - content_type = kwargs.pop("content_type", "application/json") + api_version = "2020-07-20-preview2" accept = "application/json" # Construct URL @@ -84,25 +79,17 @@ def create( # 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') - body_content_kwargs = {} # type: Dict[str, Any] - if _body is not None: - body_content = self._serialize.body(_body, 'CommunicationIdentityCreateRequest') - else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [201]: + if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) - deserialized = self._deserialize('CommunicationIdentityAccessTokenResult', pipeline_response) + deserialized = self._deserialize('CommunicationIdentity', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) @@ -116,9 +103,9 @@ def delete( **kwargs # type: Any ): # type: (...) -> None - """Delete the identity, revoke all tokens for the identity and delete all associated data. + """Delete the identity, revoke all tokens of the identity and delete all associated data. - Delete the identity, revoke all tokens for the identity and delete all associated data. + Delete the identity, revoke all tokens of the identity and delete all associated data. :param id: Identifier of the identity to be deleted. :type id: str @@ -132,8 +119,7 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-07" - accept = "application/json" + api_version = "2020-07-20-preview2" # Construct URL url = self.delete.metadata['url'] # type: ignore @@ -149,7 +135,6 @@ def delete( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) @@ -157,26 +142,28 @@ def delete( if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) delete.metadata = {'url': '/identities/{id}'} # type: ignore - def revoke_access_tokens( + def update( self, id, # type: str + tokens_valid_from=None, # type: Optional[datetime.datetime] **kwargs # type: Any ): # type: (...) -> None - """Revoke all access tokens for the specific identity. + """Update an Identity. - Revoke all access tokens for the specific identity. + Update an Identity. :param id: Identifier of the identity. :type id: str + :param tokens_valid_from: All tokens that are issued prior to this time will be revoked. + :type tokens_valid_from: ~datetime.datetime :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -187,11 +174,13 @@ def revoke_access_tokens( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-03-07" - accept = "application/json" + + _body = _models.CommunicationIdentityUpdateRequest(tokens_valid_from=tokens_valid_from) + api_version = "2020-07-20-preview2" + content_type = kwargs.pop("content_type", "application/merge-patch+json") # Construct URL - url = self.revoke_access_tokens.metadata['url'] # type: ignore + url = self.update.metadata['url'] # type: ignore path_format_arguments = { 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), 'id': self._serialize.url("id", id, 'str'), @@ -204,55 +193,57 @@ def revoke_access_tokens( # Construct headers header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - request = self._client.post(url, query_parameters, header_parameters) + body_content_kwargs = {} # type: Dict[str, Any] + 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 if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) if cls: return cls(pipeline_response, None, {}) - revoke_access_tokens.metadata = {'url': '/identities/{id}/:revokeAccessTokens'} # type: ignore + update.metadata = {'url': '/identities/{id}'} # type: ignore - def issue_access_token( + def issue_token( self, id, # type: str - scopes, # type: List[Union[str, "_models.CommunicationTokenScope"]] + scopes, # type: List[str] **kwargs # type: Any ): - # type: (...) -> "_models.CommunicationIdentityAccessToken" - """Issue a new token for an identity. + # type: (...) -> "_models.CommunicationIdentityToken" + """Generate a new token for an identity. - Issue a new token for an identity. + Generate a new token for an identity. :param id: Identifier of the identity to issue token for. :type id: str :param scopes: List of scopes attached to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] + :type scopes: list[str] :keyword callable cls: A custom type or function that will be passed the direct response - :return: CommunicationIdentityAccessToken, or the result of cls(response) - :rtype: ~azure.communication.identity.models.CommunicationIdentityAccessToken + :return: CommunicationIdentityToken, or the result of cls(response) + :rtype: ~azure.communication.identity.models.CommunicationIdentityToken :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentityAccessToken"] + cls = kwargs.pop('cls', None) # type: ClsType["_models.CommunicationIdentityToken"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - _body = _models.CommunicationIdentityAccessTokenRequest(scopes=scopes) - api_version = "2021-03-07" + _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_access_token.metadata['url'] # type: ignore + url = self.issue_token.metadata['url'] # type: ignore path_format_arguments = { 'endpoint': self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True), 'id': self._serialize.url("id", id, 'str'), @@ -269,7 +260,7 @@ def issue_access_token( header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'CommunicationIdentityAccessTokenRequest') + 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) @@ -277,13 +268,12 @@ def issue_access_token( if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.CommunicationErrorResponse, response) - raise HttpResponseError(response=response, model=error) + raise HttpResponseError(response=response) - deserialized = self._deserialize('CommunicationIdentityAccessToken', pipeline_response) + deserialized = self._deserialize('CommunicationIdentityToken', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - issue_access_token.metadata = {'url': '/identities/{id}/:issueAccessToken'} # type: ignore + issue_token.metadata = {'url': '/identities/{id}/token'} # type: ignore diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py b/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py index c75d6d937c1a..44cdf5a65e5f 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/aio/_communication_identity_client_async.py @@ -5,10 +5,11 @@ # ------------------------------------ from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.credentials import AccessToken from .._generated.aio._communication_identity_client\ import CommunicationIdentityClient as CommunicationIdentityClientGen +from .._generated.models import CommunicationIdentityToken + from .._shared.utils import parse_connection_str, get_authentication_policy from .._shared.models import CommunicationUserIdentifier from .._version import SDK_MONIKER @@ -63,7 +64,7 @@ def from_connection_string( :param str conn_str: A connection string to an Azure Communication Service resource. :returns: Instance of CommunicationIdentityClient. - :rtype: ~azure.communication.identity.aio.CommunicationIdentityClient + :rtype: ~azure.communication.aio.CommunicationIdentityClient .. admonition:: Example: @@ -83,32 +84,11 @@ async def create_user(self, **kwargs): # type: (...) -> CommunicationUserIdentifier """create a single Communication user - :return: CommunicationUserIdentifier - :rtype: ~azure.communication.identity.CommunicationUserIdentifier - """ - return await self._identity_service_client.communication_identity.create( - cls=lambda pr, u, e: CommunicationUserIdentifier(u.identity.id), - **kwargs) - - @distributed_trace_async - async def create_user_with_token( - self, - scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]] - **kwargs # type: Any - ): - # type: (...) -> Tuple[CommunicationUserIdentifier, AccessToken] - """create a single Communication user with an identity token. - :param scopes: - List of scopes to be added to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] - :return: A tuple of a CommunicationUserIdentifier and a AccessToken. - :rtype: - tuple of (~azure.communication.identity.CommunicationUserIdentifier, ~azure.core.credentials.AccessToken) + return: CommunicationUserIdentifier + rtype: ~azure.communication.identity.CommunicationUserIdentifier """ return await self._identity_service_client.communication_identity.create( - create_token_with_scopes=scopes, - cls=lambda pr, u, e: (CommunicationUserIdentifier(u.identity.id), - AccessToken(u.access_token.token, u.access_token.expires_on)), + cls=lambda pr, u, e: CommunicationUserIdentifier(u.id), **kwargs) @distributed_trace_async @@ -133,30 +113,30 @@ async def delete_user( async def issue_token( self, user, # type: CommunicationUserIdentifier - scopes, # type: List[Union[str, "_model.CommunicationTokenScope"]] + scopes, # type: List[str] **kwargs # type: Any ): - # type: (...) -> AccessToken + # type: (...) -> CommunicationIdentityToken """Generates a new token for an identity. :param user: Azure Communication User :type user: ~azure.communication.identity.CommunicationUserIdentifier :param scopes: List of scopes to be added to the token. - :type scopes: list[str or ~azure.communication.identity.models.CommunicationTokenScope] - :return: AccessToken - :rtype: ~azure.core.credentials.AccessToken + :type scopes: list[str] + :return: CommunicationIdentityToken + :rtype: ~azure.communication.identity.CommunicationIdentityToken """ - return await self._identity_service_client.communication_identity.issue_access_token( + return await self._identity_service_client.communication_identity.issue_token( user.identifier, scopes, - cls=lambda pr, u, e: AccessToken(u.token, u.expires_on), **kwargs) @distributed_trace_async async def revoke_tokens( self, user, # type: CommunicationUserIdentifier + issued_before=None, # type: Optional[datetime.datetime] **kwargs # type: Any ): # type: (...) -> None @@ -164,11 +144,14 @@ async def revoke_tokens( :param user: Azure Communication User. :type user: ~azure.communication.identity.CommunicationUserIdentifier + :param issued_before: All tokens that are issued prior to this time should get revoked. + :type issued_before: ~datetime.datetime :return: None :rtype: None """ - return await self._identity_service_client.communication_identity.revoke_access_tokens( + return await self._identity_service_client.communication_identity.update( user.identifier if user else None, + tokens_valid_from=issued_before, **kwargs) async def __aenter__(self) -> "CommunicationIdentityClient": @@ -180,6 +163,6 @@ async def __aexit__(self, *args: "Any") -> None: async def close(self) -> None: """Close the :class: - `~azure.communication.identity.aio.CommunicationIdentityClient` session. + `~azure.communication.administration.aio.CommunicationIdentityClient` session. """ await self._identity_service_client.__aexit__() diff --git a/sdk/communication/azure-communication-identity/samples/identity_samples.py b/sdk/communication/azure-communication-identity/samples/identity_samples.py index 5279fbdecf09..cf28e9fe18e8 100644 --- a/sdk/communication/azure-communication-identity/samples/identity_samples.py +++ b/sdk/communication/azure-communication-identity/samples/identity_samples.py @@ -9,13 +9,11 @@ """ FILE: identity_sample.py DESCRIPTION: - These samples demonstrate creating a user, issuing a token, revoking a token and deleting a user. + These samples demonstrate identity client samples. ///authenticating a client via a connection string USAGE: python identity_samples.py - Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url """ import os @@ -26,13 +24,10 @@ def __init__(self): self.endpoint = os.getenv('AZURE_COMMUNICATION_SERVICE_ENDPOINT') self.client_id = os.getenv('AZURE_CLIENT_ID') self.client_secret = os.getenv('AZURE_CLIENT_SECRET') - self.tenant_id = os.getenv('AZURE_TENANT_ID') + self.tenant_id = os.getnenv('AZURE_TENANT_ID') def issue_token(self): - from azure.communication.identity import ( - CommunicationIdentityClient, - CommunicationTokenScope - ) + from azure.communication.identity import CommunicationIdentityClient if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None: from azure.identity import DefaultAzureCredential @@ -40,15 +35,11 @@ def issue_token(self): else: identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) user = identity_client.create_user() - print("Issuing token for: " + user.identifier) - tokenresponse = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) - print("Token issued with value: " + tokenresponse.token) - + tokenresponse = identity_client.issue_token(user, scopes=["chat"]) + print(tokenresponse) + def revoke_tokens(self): - from azure.communication.identity import ( - CommunicationIdentityClient, - CommunicationTokenScope - ) + from azure.communication.identity import CommunicationIdentityClient if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None: from azure.identity import DefaultAzureCredential @@ -56,10 +47,9 @@ def revoke_tokens(self): else: identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) user = identity_client.create_user() - tokenresponse = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) - print("Revoking token: " + tokenresponse.token) + tokenresponse = identity_client.issue_token(user, scopes=["chat"]) identity_client.revoke_tokens(user) - print(tokenresponse.token + " revoked successfully") + print(tokenresponse) def create_user(self): from azure.communication.identity import CommunicationIdentityClient @@ -69,25 +59,9 @@ def create_user(self): identity_client = CommunicationIdentityClient(self.endpoint, DefaultAzureCredential()) else: identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) - print("Creating new user") user = identity_client.create_user() - print("User created with id:" + user.identifier) - - def create_user_with_token(self): - from azure.communication.identity import ( - CommunicationIdentityClient, - CommunicationTokenScope - ) - if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None: - from azure.identity import DefaultAzureCredential - identity_client = CommunicationIdentityClient(self.endpoint, DefaultAzureCredential()) - else: - identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) - print("Creating new user with token") - user, tokenresponse = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) - print("User created with id:" + user.identifier) - print("Token issued with value: " + tokenresponse.token) - + print(user.identifier) + def delete_user(self): from azure.communication.identity import CommunicationIdentityClient @@ -97,14 +71,11 @@ def delete_user(self): else: identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) user = identity_client.create_user() - print("Deleting user: " + user.identifier) identity_client.delete_user(user) - print(user.identifier + " deleted") if __name__ == '__main__': sample = CommunicationIdentityClientSamples() sample.create_user() - sample.create_user_with_token() + sample.delete_user() sample.issue_token() sample.revoke_tokens() - sample.delete_user() diff --git a/sdk/communication/azure-communication-identity/samples/identity_samples_async.py b/sdk/communication/azure-communication-identity/samples/identity_samples_async.py index 9bf2561b9a29..2b2b8e17b992 100644 --- a/sdk/communication/azure-communication-identity/samples/identity_samples_async.py +++ b/sdk/communication/azure-communication-identity/samples/identity_samples_async.py @@ -9,13 +9,11 @@ """ FILE: identity_sample_async.py DESCRIPTION: - These async samples demonstrate creating a user, issuing a token, revoking a token and deleting a user. + These samples demonstrate async identity client samples. ///authenticating a client via a connection string USAGE: python identity_samples_async.py - Set the environment variables with your own values before running the sample: - 1) AZURE_COMMUNICATION_SERVICE_ENDPOINT - Communication Service endpoint url """ import asyncio @@ -29,11 +27,10 @@ def __init__(self): self.endpoint = os.getenv('AZURE_COMMUNICATION_SERVICE_ENDPOINT') self.client_id = os.getenv('AZURE_CLIENT_ID') self.client_secret = os.getenv('AZURE_CLIENT_SECRET') - self.tenant_id = os.getenv('AZURE_TENANT_ID') + self.tenant_id = os.getnenv('AZURE_TENANT_ID') async def issue_token(self): from azure.communication.identity.aio import CommunicationIdentityClient - from azure.communication.identity import CommunicationTokenScope if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None: from azure.identity import DefaultAzureCredential identity_client = CommunicationIdentityClient(self.endpoint, DefaultAzureCredential()) @@ -42,13 +39,12 @@ async def issue_token(self): async with identity_client: user = await identity_client.create_user() - print("Issuing token for: " + user.identifier) - tokenresponse = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) - print("Token issued with value: " + tokenresponse.token) - + print(user.identifier) + tokenresponse = await identity_client.issue_token(user, scopes=["chat"]) + print(tokenresponse) + async def revoke_tokens(self): from azure.communication.identity.aio import CommunicationIdentityClient - from azure.communication.identity import CommunicationTokenScope if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None: from azure.identity import DefaultAzureCredential identity_client = CommunicationIdentityClient(self.endpoint, DefaultAzureCredential()) @@ -57,10 +53,9 @@ async def revoke_tokens(self): async with identity_client: user = await identity_client.create_user() - tokenresponse = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) - print("Revoking token: " + tokenresponse.token) + tokenresponse = await identity_client.issue_token(user, scopes=["chat"]) await identity_client.revoke_tokens(user) - print(tokenresponse.token + " revoked successfully") + print(tokenresponse) async def create_user(self): from azure.communication.identity.aio import CommunicationIdentityClient @@ -71,24 +66,8 @@ async def create_user(self): identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) async with identity_client: - print("Creating new user") user = await identity_client.create_user() - print("User created with id:" + user.identifier) - - async def create_user_with_token(self): - from azure.communication.identity.aio import CommunicationIdentityClient - from azure.communication.identity import CommunicationTokenScope - if self.client_id is not None and self.client_secret is not None and self.tenant_id is not None: - from azure.identity import DefaultAzureCredential - identity_client = CommunicationIdentityClient(self.endpoint, DefaultAzureCredential()) - else: - identity_client = CommunicationIdentityClient.from_connection_string(self.connection_string) - - async with identity_client: - print("Creating new user with token") - user, tokenresponse = await identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) - print("User created with id:" + user.identifier) - print("Token issued with value: " + tokenresponse.token) + print(user.identifier) async def delete_user(self): from azure.communication.identity.aio import CommunicationIdentityClient @@ -100,17 +79,14 @@ async def delete_user(self): async with identity_client: user = await identity_client.create_user() - print("Deleting user: " + user.identifier) await identity_client.delete_user(user) - print(user.identifier + " deleted") async def main(): sample = CommunicationIdentityClientSamples() await sample.create_user() - await sample.create_user_with_token() + await sample.delete_user() await sample.issue_token() await sample.revoke_tokens() - await sample.delete_user() if __name__ == '__main__': loop = asyncio.get_event_loop() diff --git a/sdk/communication/azure-communication-identity/swagger/SWAGGER.md b/sdk/communication/azure-communication-identity/swagger/SWAGGER.md index 5e9b9b82510e..164f24e0e24d 100644 --- a/sdk/communication/azure-communication-identity/swagger/SWAGGER.md +++ b/sdk/communication/azure-communication-identity/swagger/SWAGGER.md @@ -15,7 +15,7 @@ autorest ./SWAGGER.md ### Settings ``` yaml -input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/5b19c6e69cd2bb9dbe4e5c1237b2c5a175d90ca5/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/stable/2021-03-07/CommunicationIdentity.json +input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/8818a603b78a1355ba1647ab9cd4e3354cdc4b69/specification/communication/data-plane/Microsoft.CommunicationServicesIdentity/preview/2020-07-20-preview2/CommunicationIdentity.json output-folder: ../azure/communication/identity/_generated/ namespace: azure.communication.identity license-header: MICROSOFT_MIT_NO_VERSION @@ -25,11 +25,3 @@ clear-output-folder: true v3: true python: true ``` - -### Rename CommunicationIdentityTokenScope to CommunicationTokenScope -```yaml -directive: - - from: swagger-document - where: $.definitions.CommunicationIdentityTokenScope - transform: > - $["x-ms-enum"].name = "CommunicationTokenScope"; \ No newline at end of file diff --git a/sdk/communication/azure-communication-identity/tests/_shared/testcase.py b/sdk/communication/azure-communication-identity/tests/_shared/testcase.py index c06c0bf5b1a5..f56f17e56a46 100644 --- a/sdk/communication/azure-communication-identity/tests/_shared/testcase.py +++ b/sdk/communication/azure-communication-identity/tests/_shared/testcase.py @@ -48,21 +48,14 @@ def process_response(self, response): response['body']['string'] = self._replace_keys(response['body']['string']) return response - - def _replace_keys(self, body): - def _replace_recursively(dictionary): - if type(dictionary) != dict: - return - for key in dictionary: - if key in self._keys: - dictionary[key] = self._replacement - else: - _replace_recursively(dictionary[key]) + def _replace_keys(self, body): import json try: body = json.loads(body) - _replace_recursively(body) + for key in self._keys: + if key in body: + body[key] = self._replacement except (KeyError, ValueError): return body diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user.yaml index a5bc813701dc..1973cd353437 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,36 +9,34 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' Date: - - Fri, 29 Jan 2021 22:48:30 GMT + - Tue, 22 Dec 2020 18:26:56 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:48:29 GMT + - Tue, 22 Dec 2020 18:26:55 GMT ms-cv: - - 8tfK3/iTvEmwjYUYlPn7Qg.0 + - 4whAoum970WIzePHLz1Ujg.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 209ms + - 18ms status: - code: 201 - message: Created + code: 200 + message: OK version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user_from_managed_identity.yaml index 2a6a22b80e6b..7ddd5c68dcc7 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user_from_managed_identity.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,32 +9,30 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:21:01 GMT + - Tue, 22 Dec 2020 18:28:04 GMT ms-cv: - - T/Hx9aJuMka5ZSLjy1uvxA.0 + - /4JsXqUuEkmQ1v304iaBTw.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 247ms + - 635ms status: - code: 201 - message: Created + code: 200 + message: OK version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user_with_token.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user_with_token.yaml deleted file mode 100644 index d0e3e6b7a986..000000000000 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_create_user_with_token.yaml +++ /dev/null @@ -1,45 +0,0 @@ -interactions: -- request: - body: '{"createTokenWithScopes": ["chat"]}' - headers: - Accept: - - application/json - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '35' - Content-Type: - - application/json - Date: - - Fri, 29 Jan 2021 22:50:21 GMT - User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) - x-ms-return-client-request-id: - - 'true' - method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 - response: - body: - string: '{"identity": {"id": "sanitized"}, "accessToken": {"token": "sanitized", - "expiresOn": "2021-01-30T22:50:20.3668737+00:00"}}' - headers: - api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 - content-type: - - application/json; charset=utf-8 - date: - - Fri, 29 Jan 2021 22:50:20 GMT - ms-cv: - - 4wYYchxOnEay3S80a4tugw.0 - strict-transport-security: - - max-age=2592000 - transfer-encoding: - - chunked - x-processing-time: - - 38ms - status: - code: 201 - message: Created -version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user.yaml index 4bce56996e55..40564943ea37 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,43 +9,41 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' Date: - - Fri, 29 Jan 2021 22:23:15 GMT + - Tue, 22 Dec 2020 18:29:13 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:23:14 GMT + - Tue, 22 Dec 2020 18:29:12 GMT ms-cv: - - TgHUTqnyBk+TTGrk+qGYCg.0 + - UzbbWyNM6Ee4hx1Ym7MwSA.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 22ms + - 19ms status: - code: 201 - message: Created + code: 200 + message: OK - request: body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate Connection: @@ -53,27 +51,27 @@ interactions: Content-Length: - '0' Date: - - Fri, 29 Jan 2021 22:23:15 GMT + - Tue, 22 Dec 2020 18:29:14 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: DELETE - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 date: - - Fri, 29 Jan 2021 22:23:14 GMT + - Tue, 22 Dec 2020 18:29:13 GMT ms-cv: - - phAKzopa7kCat9napbUQGQ.0 + - bD8oBIuNQEWXEaluFwupbA.0 strict-transport-security: - max-age=2592000 x-processing-time: - - 245ms + - 764ms status: code: 204 message: No Content diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user_from_managed_identity.yaml index ecf04ae480d1..7e794bd59a59 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_delete_user_from_managed_identity.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,39 +9,37 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:24:21 GMT + - Tue, 22 Dec 2020 18:30:23 GMT ms-cv: - - 8Dz7rbKlnUyC0X9hMkHkGg.0 + - eSMH8ZATxUWO5OamG49Wdg.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 203ms + - 811ms status: - code: 201 - message: Created + code: 200 + message: OK - request: body: null headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate Connection: @@ -49,23 +47,23 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: DELETE - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 date: - - Fri, 29 Jan 2021 22:24:21 GMT + - Tue, 22 Dec 2020 18:30:24 GMT ms-cv: - - 573z+Dhr+UOuJm8r75diNA.0 + - 91lJNqPMP0+hZnY0ay0tXA.0 strict-transport-security: - max-age=2592000 x-processing-time: - - 479ms + - 741ms status: code: 204 message: No Content diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token.yaml index 78e4af9e7e07..1645441b4fd6 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,38 +9,36 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' Date: - - Fri, 29 Jan 2021 22:25:29 GMT + - Tue, 22 Dec 2020 18:31:34 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:25:28 GMT + - Tue, 22 Dec 2020 18:31:32 GMT ms-cv: - - izpRZUdB/kyDNywz7m1KQQ.0 + - OXm+S4D9ak+t0Y4jKA3bFA.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 20ms + - 24ms status: - code: 201 - message: Created + code: 200 + message: OK - request: body: '{"scopes": ["chat"]}' headers: @@ -55,31 +53,31 @@ interactions: Content-Type: - application/json Date: - - Fri, 29 Jan 2021 22:25:29 GMT + - Tue, 22 Dec 2020 18:31:34 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:25:27.9464673+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:31:32.3009076+00:00"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:25:28 GMT + - Tue, 22 Dec 2020 18:31:32 GMT ms-cv: - - p2Kp9U6Jek6X2zToYblIHA.0 + - EArcgkwtPkCU38ZbLjwJEQ.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 26ms + - 24ms status: code: 200 message: OK diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token_from_managed_identity.yaml index e08c29cde49b..bd088f82a792 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_issue_token_from_managed_identity.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,34 +9,32 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:26:36 GMT + - Tue, 22 Dec 2020 18:32:41 GMT ms-cv: - - sIImdgIO6kSSfNEh18vBHQ.0 + - NcQPodkL5UOzC+AtKJcXvw.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 203ms + - 501ms status: - code: 201 - message: Created + code: 200 + message: OK - request: body: '{"scopes": ["chat"]}' headers: @@ -51,27 +49,27 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:26:35.9312051+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:32:41.3736569+00:00"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:26:36 GMT + - Tue, 22 Dec 2020 18:32:41 GMT ms-cv: - - JPBOQWSIBUWpPLVKMVZSTw.0 + - W4rjQkxkvUSQqyJk5dUwCA.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 30ms + - 27ms status: code: 200 message: OK diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens.yaml index 1f520f645a24..99b3257388c8 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,38 +9,36 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' Date: - - Fri, 29 Jan 2021 22:27:44 GMT + - Tue, 22 Dec 2020 18:34:17 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:27:43 GMT + - Tue, 22 Dec 2020 18:34:16 GMT ms-cv: - - xE21Gmx5h0mpZbTaV4qWcA.0 + - ZDSP6Prb6UGYOTBLvb6AdQ.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 20ms + - 23ms status: - code: 201 - message: Created + code: 200 + message: OK - request: body: '{"scopes": ["chat"]}' headers: @@ -55,67 +53,69 @@ interactions: Content-Type: - application/json Date: - - Fri, 29 Jan 2021 22:27:44 GMT + - Tue, 22 Dec 2020 18:34:18 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:27:42.9428277+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:34:15.7537392+00:00"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:27:43 GMT + - Tue, 22 Dec 2020 18:34:16 GMT ms-cv: - - q5Uz363zF0aE4eQEN8C8Ng.0 + - Hmv1R+jifUSsezIU2yJU8Q.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 26ms + - 31ms status: code: 200 message: OK - request: - body: null + body: '{}' headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate Connection: - keep-alive Content-Length: - - '0' + - '2' + Content-Type: + - application/merge-patch+json Date: - - Fri, 29 Jan 2021 22:27:44 GMT + - Tue, 22 Dec 2020 18:34:18 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' - method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:revokeAccessTokens?api-version=2021-03-07 + method: PATCH + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 date: - - Fri, 29 Jan 2021 22:27:43 GMT + - Tue, 22 Dec 2020 18:34:16 GMT ms-cv: - - IZVgWwmBk06K7QlAXuz7LQ.0 + - vwznKj2MY0qO9HTJ9YWIRw.0 strict-transport-security: - max-age=2592000 x-processing-time: - - 178ms + - 11ms status: code: 204 message: No Content diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens_from_managed_identity.yaml index 433cabb9de4f..d0fd1490c76e 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client.test_revoke_tokens_from_managed_identity.yaml @@ -1,6 +1,6 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json @@ -9,34 +9,32 @@ interactions: Connection: - keep-alive Content-Length: - - '2' - Content-Type: - - application/json + - '0' User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:28:50 GMT + - Tue, 22 Dec 2020 18:35:27 GMT ms-cv: - - VDeJxLCpwEiwT+0DkDgQ/w.0 + - QmngflWD+EOVXH7i/FS+iw.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 258ms + - 792ms status: - code: 201 - message: Created + code: 200 + message: OK - request: body: '{"scopes": ["chat"]}' headers: @@ -51,59 +49,61 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:28:50.160399+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:35:27.28321+00:00"}' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: - application/json; charset=utf-8 date: - - Fri, 29 Jan 2021 22:28:50 GMT + - Tue, 22 Dec 2020 18:35:27 GMT ms-cv: - - qGOKcdu3m0Cwmnn0J3k7Tw.0 + - PRIzOxRVQkycMUEl6WNjHw.0 strict-transport-security: - max-age=2592000 transfer-encoding: - chunked x-processing-time: - - 32ms + - 30ms status: code: 200 message: OK - request: - body: null + body: '{}' headers: Accept: - - application/json + - '*/*' Accept-Encoding: - gzip, deflate Connection: - keep-alive Content-Length: - - '0' + - '2' + Content-Type: + - application/merge-patch+json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) - method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:revokeAccessTokens?api-version=2021-03-07 + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + method: PATCH + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: api-supported-versions: - - 2020-07-20-preview2, 2021-03-07 + - 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 date: - - Fri, 29 Jan 2021 22:28:51 GMT + - Tue, 22 Dec 2020 18:35:27 GMT ms-cv: - - GGw7vBUa70CbJs5Df0aTSw.0 + - mUk2cNSJI0e/Nz7J7yCGYg.0 strict-transport-security: - max-age=2592000 x-processing-time: - - 581ms + - 11ms status: code: 204 message: No Content diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user.yaml index fda7a5c22f39..1a9a4508d65a 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user.yaml @@ -1,34 +1,30 @@ interactions: - request: - body: '{}' + body: '' headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json Date: - - Fri, 29 Jan 2021 22:29:58 GMT + - Tue, 22 Dec 2020 18:48:56 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:29:57 GMT - ms-cv: 1YYCfhRcFkym4hrqBRGZFQ.0 + date: Tue, 22 Dec 2020 18:48:54 GMT + ms-cv: vfIkgQk+J0OWSV4P3J1i0w.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 19ms + x-processing-time: 22ms status: - code: 201 - message: Created - url: https://communicationasqoly6jb4x.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communicationtrnhzmurqrr.communication.azure.com/identities?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user_from_managed_identity.yaml index 1e2fd2003d1f..b723acbffebd 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user_from_managed_identity.yaml @@ -1,30 +1,26 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:31:04 GMT - ms-cv: z+LL7RQr+U+x/tyygix5Fg.0 + date: Tue, 22 Dec 2020 18:50:04 GMT + ms-cv: fj3guox5CUSvTCDG5gI0YA.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 183ms + x-processing-time: 534ms status: - code: 201 - message: Created - url: https://communication3ijwjphimwr.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communicationr7rdwwqs74n.communication.azure.com/identities?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user_with_token.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user_with_token.yaml deleted file mode 100644 index a1f51269e36a..000000000000 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_create_user_with_token.yaml +++ /dev/null @@ -1,35 +0,0 @@ -interactions: -- request: - body: '{"createTokenWithScopes": ["chat"]}' - headers: - Accept: - - application/json - Content-Length: - - '35' - Content-Type: - - application/json - Date: - - Fri, 29 Jan 2021 22:32:18 GMT - User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) - x-ms-return-client-request-id: - - 'true' - method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 - response: - body: - string: '{"identity": {"id": "sanitized"}, "accessToken": {"token": "sanitized", - "expiresOn": "2021-01-30T22:32:16.9405213+00:00"}}' - headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 - content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:32:17 GMT - ms-cv: W1T1PVQFlEWIXcgu0EeooA.0 - strict-transport-security: max-age=2592000 - transfer-encoding: chunked - x-processing-time: 35ms - status: - code: 201 - message: Created - url: https://communication6l4km7ph3zj.communication.azure.com/identities?api-version=2021-03-07 -version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user.yaml index 0b2eab2624c7..d72ac521ab0f 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user.yaml @@ -1,60 +1,54 @@ interactions: - request: - body: '{}' + body: '' headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json Date: - - Fri, 29 Jan 2021 22:33:25 GMT + - Tue, 22 Dec 2020 18:51:13 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:33:24 GMT - ms-cv: E+HUdaa+gE+cpD1TJJKNSg.0 + date: Tue, 22 Dec 2020 18:51:12 GMT + ms-cv: dHk7/E5BhUSf+g3Bkg94YQ.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 19ms + x-processing-time: 22ms status: - code: 201 - message: Created - url: https://communicationzgvvggklwoa.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communication42hz4pfbosr.communication.azure.com/identities?api-version=2020-07-20-preview2 - request: body: '' headers: - Accept: - - application/json Date: - - Fri, 29 Jan 2021 22:33:25 GMT + - Tue, 22 Dec 2020 18:51:14 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: DELETE - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 - date: Fri, 29 Jan 2021 22:33:25 GMT - ms-cv: q02XjOHx2EKny82QMeoybA.0 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 + date: Tue, 22 Dec 2020 18:51:12 GMT + ms-cv: 3DnY9x3jNUGrGnsi3LP0SA.0 strict-transport-security: max-age=2592000 - x-processing-time: 854ms + x-processing-time: 440ms status: code: 204 message: No Content - url: https://communicationzgvvggklwoa.communication.azure.com/identities/sanitized?api-version=2021-03-07 + url: https://communication42hz4pfbosr.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user_from_managed_identity.yaml index a5f8633cb199..61f0f792823b 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_delete_user_from_managed_identity.yaml @@ -1,52 +1,46 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:34:32 GMT - ms-cv: M4o3j8QviU6dfW/2cZS4ug.0 + date: Tue, 22 Dec 2020 18:52:27 GMT + ms-cv: ww9tz7CpG0SXqqYPyV70Cw.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 242ms + x-processing-time: 192ms status: - code: 201 - message: Created - url: https://communicationvfxjz4kgs5q.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communicationrscjfarclwr.communication.azure.com/identities?api-version=2020-07-20-preview2 - request: body: null headers: - Accept: - - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: DELETE - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 - date: Fri, 29 Jan 2021 22:34:33 GMT - ms-cv: 4NslPsnjL0iQ1CODgbz7TA.0 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 + date: Tue, 22 Dec 2020 18:52:28 GMT + ms-cv: baDrTbu3H0qpWj2TJSno0A.0 strict-transport-security: max-age=2592000 - x-processing-time: 676ms + x-processing-time: 864ms status: code: 204 message: No Content - url: https://communicationvfxjz4kgs5q.communication.azure.com/identities/sanitized?api-version=2021-03-07 + url: https://communicationrscjfarclwr.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token.yaml index 32210dc46be7..3f080a769093 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token.yaml @@ -1,36 +1,32 @@ interactions: - request: - body: '{}' + body: '' headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json Date: - - Fri, 29 Jan 2021 22:35:42 GMT + - Tue, 22 Dec 2020 18:53:37 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:35:41 GMT - ms-cv: d5Ncfb9TeEWiZ8EGWkToTw.0 + date: Tue, 22 Dec 2020 18:53:36 GMT + ms-cv: Agl32miSq0CTEladXG7lbw.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 205ms + x-processing-time: 20ms status: - code: 201 - message: Created - url: https://communicationdo2ohmwsm52.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communicatione77tfh7y2ht.communication.azure.com/identities?api-version=2020-07-20-preview2 - request: body: '{"scopes": ["chat"]}' headers: @@ -41,26 +37,26 @@ interactions: Content-Type: - application/json Date: - - Fri, 29 Jan 2021 22:35:42 GMT + - Tue, 22 Dec 2020 18:53:38 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:35:41.2292482+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:53:35.7585148+00:00"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:35:42 GMT - ms-cv: DoX6Mm/9pkqFtpHOKzWiAg.0 + date: Tue, 22 Dec 2020 18:53:36 GMT + ms-cv: P3rSrWhwykmJcOW+Yb8Q2w.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 215ms + x-processing-time: 26ms status: code: 200 message: OK - url: https://communicationdo2ohmwsm52.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + url: https://communicatione77tfh7y2ht.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token_from_managed_identity.yaml index e70320714b8b..1bb9bfee6b30 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_issue_token_from_managed_identity.yaml @@ -1,32 +1,28 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:36:49 GMT - ms-cv: cUzRyy4LbUigYrZ7lbi4wA.0 + date: Tue, 22 Dec 2020 18:54:45 GMT + ms-cv: UywF8dbxrkyYXGTozRnuIw.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 238ms + x-processing-time: 773ms status: - code: 201 - message: Created - url: https://communication5brewzlj3te.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communicationztg2acjbipc.communication.azure.com/identities?api-version=2020-07-20-preview2 - request: body: '{"scopes": ["chat"]}' headers: @@ -37,22 +33,22 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:36:48.7283566+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:54:45.1115885+00:00"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:36:49 GMT - ms-cv: bFRoAJk3ikGgv2ot2Vwh4A.0 + date: Tue, 22 Dec 2020 18:54:45 GMT + ms-cv: ywaIOOtf9EiQs6pibQmCwg.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 26ms + x-processing-time: 25ms status: code: 200 message: OK - url: https://communication5brewzlj3te.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + url: https://communicationztg2acjbipc.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens.yaml index 7b6b2c57a1fe..65852601867e 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens.yaml @@ -1,36 +1,32 @@ interactions: - request: - body: '{}' + body: '' headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json Date: - - Fri, 29 Jan 2021 22:37:56 GMT + - Tue, 22 Dec 2020 18:55:56 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:37:55 GMT - ms-cv: vJReSgsEzEC1EVRdWZnCWA.0 + date: Tue, 22 Dec 2020 18:55:55 GMT + ms-cv: M9b8kGAz8UGwsoZe2mFLCA.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 22ms + x-processing-time: 29ms status: - code: 201 - message: Created - url: https://communication2xbng6lk65f.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communicationngn6p2kywhg.communication.azure.com/identities?api-version=2020-07-20-preview2 - request: body: '{"scopes": ["chat"]}' headers: @@ -41,52 +37,54 @@ interactions: Content-Type: - application/json Date: - - Fri, 29 Jan 2021 22:37:56 GMT + - Tue, 22 Dec 2020 18:55:57 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:37:54.9493083+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:55:54.788117+00:00"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:37:55 GMT - ms-cv: nQk1/zvYyEiAvNDwqRdZAg.0 + date: Tue, 22 Dec 2020 18:55:55 GMT + ms-cv: MBCUlMoRBECvCLmV00eWXw.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 28ms + x-processing-time: 27ms status: code: 200 message: OK - url: https://communication2xbng6lk65f.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + url: https://communicationngn6p2kywhg.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 - request: - body: '' + body: '{}' headers: - Accept: - - application/json + Content-Length: + - '2' + Content-Type: + - application/merge-patch+json Date: - - Fri, 29 Jan 2021 22:37:56 GMT + - Tue, 22 Dec 2020 18:55:57 GMT User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) x-ms-return-client-request-id: - 'true' - method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:revokeAccessTokens?api-version=2021-03-07 + method: PATCH + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 - date: Fri, 29 Jan 2021 22:37:55 GMT - ms-cv: Bf9FLiU9kkm2bE7qs4H8Yw.0 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 + date: Tue, 22 Dec 2020 18:55:55 GMT + ms-cv: MVgoSrOVSkiU0c+teqMDZQ.0 strict-transport-security: max-age=2592000 - x-processing-time: 674ms + x-processing-time: 10ms status: code: 204 message: No Content - url: https://communication2xbng6lk65f.communication.azure.com/identities/sanitized/:revokeAccessTokens?api-version=2021-03-07 + url: https://communicationngn6p2kywhg.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens_from_managed_identity.yaml b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens_from_managed_identity.yaml index ff0c50a514a8..75a1a9851624 100644 --- a/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens_from_managed_identity.yaml +++ b/sdk/communication/azure-communication-identity/tests/recordings/test_communication_identity_client_async.test_revoke_tokens_from_managed_identity.yaml @@ -1,32 +1,28 @@ interactions: - request: - body: '{}' + body: null headers: Accept: - application/json - Content-Length: - - '2' - Content-Type: - - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities?api-version=2020-07-20-preview2 response: body: - string: '{"identity": {"id": "sanitized"}}' + string: '{"id": "sanitized"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:39:03 GMT - ms-cv: /SEx2qFrG0afGsUyQ/WtaQ.0 + date: Tue, 22 Dec 2020 18:57:03 GMT + ms-cv: a9v8/cRgN0uyuQQUguwkGA.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 325ms + x-processing-time: 195ms status: - code: 201 - message: Created - url: https://communicationztcvutdsdqx.communication.azure.com/identities?api-version=2021-03-07 + code: 200 + message: OK + url: https://communicationxheui257vce.communication.azure.com/identities?api-version=2020-07-20-preview2 - request: body: '{"scopes": ["chat"]}' headers: @@ -37,44 +33,46 @@ interactions: Content-Type: - application/json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) + - azsdk-python-communication-identity/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 response: body: - string: '{"token": "sanitized", "expiresOn": "2021-01-30T22:39:02.9481803+00:00"}' + string: '{"id": "sanitized", "token": "sanitized", "expiresOn": "2020-12-23T18:57:03.4428768+00:00"}' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 content-type: application/json; charset=utf-8 - date: Fri, 29 Jan 2021 22:39:03 GMT - ms-cv: ZzKd7QU4k0Or4Bt/g0hClg.0 + date: Tue, 22 Dec 2020 18:57:03 GMT + ms-cv: Oc9n/N0oA0mLVBlk8UaTpw.0 strict-transport-security: max-age=2592000 transfer-encoding: chunked - x-processing-time: 25ms + x-processing-time: 24ms status: code: 200 message: OK - url: https://communicationztcvutdsdqx.communication.azure.com/identities/sanitized/:issueAccessToken?api-version=2021-03-07 + url: https://communicationxheui257vce.communication.azure.com/identities/sanitized/token?api-version=2020-07-20-preview2 - request: - body: null + body: '{}' headers: - Accept: - - application/json + Content-Length: + - '2' + Content-Type: + - application/merge-patch+json User-Agent: - - azsdk-python-communication-identity/1.0.0b4 Python/3.9.0 (Windows-10-10.0.19041-SP0) - method: POST - uri: https://communicationegrcrs.communication.azure.com/identities/sanitized/:revokeAccessTokens?api-version=2021-03-07 + - azsdk-python-communication-administration/1.0.0b4 Python/3.8.5 (Windows-10-10.0.19041-SP0) + method: PATCH + uri: https://communicationegrcrs.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 response: body: string: '' headers: - api-supported-versions: 2020-07-20-preview2, 2021-03-07 - date: Fri, 29 Jan 2021 22:39:03 GMT - ms-cv: F8O7efYC2EWG7TZ3/dJFpA.0 + api-supported-versions: 2020-01-15-preview3, 2020-07-20-preview1, 2020-07-20-preview2 + date: Tue, 22 Dec 2020 18:57:03 GMT + ms-cv: lBOoIDU5lUe2vbpjz5+Gkg.0 strict-transport-security: max-age=2592000 - x-processing-time: 616ms + x-processing-time: 11ms status: code: 204 message: No Content - url: https://communicationztcvutdsdqx.communication.azure.com/identities/sanitized/:revokeAccessTokens?api-version=2021-03-07 + url: https://communicationxheui257vce.communication.azure.com/identities/sanitized?api-version=2020-07-20-preview2 version: 1 diff --git a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py index dbbda4811a89..9fc58152be3c 100644 --- a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py +++ b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client.py @@ -6,7 +6,6 @@ # -------------------------------------------------------------------------- import pytest from azure.communication.identity import CommunicationIdentityClient -from azure.communication.identity import CommunicationTokenScope from azure.core.credentials import AccessToken from _shared.helper import URIIdentityReplacer from _shared.testcase import ( @@ -54,15 +53,6 @@ def test_create_user(self, connection_string): assert user.identifier is not None - @ResourceGroupPreparer(random_name_enabled=True) - @CommunicationServicePreparer() - def test_create_user_with_token(self, connection_string): - identity_client = CommunicationIdentityClient.from_connection_string(connection_string) - user, token_response = identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) - - assert user.identifier is not None - assert token_response.token is not None - @ResourceGroupPreparer(random_name_enabled=True) @CommunicationServicePreparer() def test_issue_token_from_managed_identity(self, connection_string): @@ -75,7 +65,7 @@ def test_issue_token_from_managed_identity(self, connection_string): identity_client = CommunicationIdentityClient(endpoint, credential) user = identity_client.create_user() - token_response = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = identity_client.issue_token(user, scopes=["chat"]) assert user.identifier is not None assert token_response.token is not None @@ -87,7 +77,7 @@ def test_issue_token(self, connection_string): connection_string) user = identity_client.create_user() - token_response = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = identity_client.issue_token(user, scopes=["chat"]) assert user.identifier is not None assert token_response.token is not None @@ -104,7 +94,7 @@ def test_revoke_tokens_from_managed_identity(self, connection_string): identity_client = CommunicationIdentityClient(endpoint, credential) user = identity_client.create_user() - token_response = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = identity_client.issue_token(user, scopes=["chat"]) identity_client.revoke_tokens(user) assert user.identifier is not None @@ -117,7 +107,7 @@ def test_revoke_tokens(self, connection_string): connection_string) user = identity_client.create_user() - token_response = identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = identity_client.issue_token(user, scopes=["chat"]) identity_client.revoke_tokens(user) assert user.identifier is not None diff --git a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py index eba81941ccb2..0dafc2b5b76c 100644 --- a/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py +++ b/sdk/communication/azure-communication-identity/tests/test_communication_identity_client_async.py @@ -7,7 +7,6 @@ import pytest from azure.core.credentials import AccessToken from azure.communication.identity.aio import CommunicationIdentityClient -from azure.communication.identity import CommunicationTokenScope from azure.communication.identity._shared.utils import parse_connection_str from azure_devtools.scenario_tests import RecordingProcessor from devtools_testutils import ResourceGroupPreparer @@ -54,16 +53,6 @@ async def test_create_user(self, connection_string): assert user.identifier is not None - @ResourceGroupPreparer(random_name_enabled=True) - @CommunicationServicePreparer() - async def test_create_user_with_token(self, connection_string): - identity_client = CommunicationIdentityClient.from_connection_string(connection_string) - async with identity_client: - user, token_response = await identity_client.create_user_with_token(scopes=[CommunicationTokenScope.CHAT]) - - assert user.identifier is not None - assert token_response.token is not None - @ResourceGroupPreparer(random_name_enabled=True) @CommunicationServicePreparer() async def test_issue_token_from_managed_identity(self, connection_string): @@ -76,7 +65,7 @@ async def test_issue_token_from_managed_identity(self, connection_string): identity_client = CommunicationIdentityClient(endpoint, credential) async with identity_client: user = await identity_client.create_user() - token_response = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = await identity_client.issue_token(user, scopes=["chat"]) assert user.identifier is not None assert token_response.token is not None @@ -87,7 +76,7 @@ async def test_issue_token(self, connection_string): identity_client = CommunicationIdentityClient.from_connection_string(connection_string) async with identity_client: user = await identity_client.create_user() - token_response = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = await identity_client.issue_token(user, scopes=["chat"]) assert user.identifier is not None assert token_response.token is not None @@ -104,7 +93,7 @@ async def test_revoke_tokens_from_managed_identity(self, connection_string): identity_client = CommunicationIdentityClient(endpoint, credential) async with identity_client: user = await identity_client.create_user() - token_response = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = await identity_client.issue_token(user, scopes=["chat"]) await identity_client.revoke_tokens(user) assert user.identifier is not None @@ -116,7 +105,7 @@ async def test_revoke_tokens(self, connection_string): identity_client = CommunicationIdentityClient.from_connection_string(connection_string) async with identity_client: user = await identity_client.create_user() - token_response = await identity_client.issue_token(user, scopes=[CommunicationTokenScope.CHAT]) + token_response = await identity_client.issue_token(user, scopes=["chat"]) await identity_client.revoke_tokens(user) assert user.identifier is not None