diff --git a/sdk/communication/azure-mgmt-communication/CHANGELOG.md b/sdk/communication/azure-mgmt-communication/CHANGELOG.md index beb608aff967..7f10abcc4fc7 100644 --- a/sdk/communication/azure-mgmt-communication/CHANGELOG.md +++ b/sdk/communication/azure-mgmt-communication/CHANGELOG.md @@ -1,5 +1,20 @@ # Release History +## 2.0.0b3 (2023-03-23) + +### Features Added + + - Added operation CommunicationServicesOperations.regenerate_key + - Added operation CommunicationServicesOperations.update + - Added operation group SenderUsernamesOperations + +### Breaking Changes + + - Model DomainResource no longer has parameter valid_sender_usernames + - Model UpdateDomainRequestParameters no longer has parameter valid_sender_usernames + - Removed operation CommunicationServicesOperations.begin_regenerate_key + - Removed operation CommunicationServicesOperations.begin_update + ## 2.0.0b2 (2022-11-28) ### Other Changes diff --git a/sdk/communication/azure-mgmt-communication/README.md b/sdk/communication/azure-mgmt-communication/README.md index acbab8b1e02c..59d61e762e10 100644 --- a/sdk/communication/azure-mgmt-communication/README.md +++ b/sdk/communication/azure-mgmt-communication/README.md @@ -8,17 +8,53 @@ For a more complete view of Azure libraries, see the [azure sdk python release]( _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ -# Usage +## Getting started +### Prerequisites -To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) - -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) -Code samples for this package can be found at [Communication Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. -Additional code samples for different Azure services are available at [Samples Repo](https://github.com/Azure-Samples/azure-samples-python-management/tree/main/samples/communication) +- Python 3.7+ is required to use this package. +- [Azure subscription](https://azure.microsoft.com/free/) +### Install the package -# Provide Feedback +```bash +pip install azure-mgmt-communication +pip install azure-identity +``` + +### Authentication + +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. + +- `AZURE_CLIENT_ID` for Azure client ID. +- `AZURE_TENANT_ID` for Azure tenant ID. +- `AZURE_CLIENT_SECRET` for Azure client secret. + +In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, client can be authenticated by following code: + +```python +from azure.identity import DefaultAzureCredential +from azure.mgmt.communication import CommunicationServiceManagementClient +import os + +sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") +client = CommunicationServiceManagementClient(credential=DefaultAzureCredential(), subscription_id=sub_id) +``` + +## Examples + +Code samples for this package can be found at: +- [Search Communication Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com +- [Azure Python Mgmt SDK Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +## Troubleshooting + +## Next steps + +## Provide Feedback If you encounter any bugs or have suggestions, please file an issue in the [Issues](https://github.com/Azure/azure-sdk-for-python/issues) diff --git a/sdk/communication/azure-mgmt-communication/_meta.json b/sdk/communication/azure-mgmt-communication/_meta.json index 148cf6d702fc..a1d612f39e1f 100644 --- a/sdk/communication/azure-mgmt-communication/_meta.json +++ b/sdk/communication/azure-mgmt-communication/_meta.json @@ -1,11 +1,11 @@ { - "commit": "1fefe3f5cee88319b17c08a2dbf95e1e983a9f8c", + "commit": "6999a987a54bd6e1895c3abc9da7637503cb56e7", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.2", "use": [ - "@autorest/python@6.2.7", + "@autorest/python@6.4.3", "@autorest/modelerfour@4.24.3" ], - "autorest_command": "autorest specification/communication/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.2.7 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", + "autorest_command": "autorest specification/communication/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.4.3 --use=@autorest/modelerfour@4.24.3 --version=3.9.2 --version-tolerant=False", "readme": "specification/communication/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py index 8990d9f8ae2e..595d7fd450a6 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_communication_service_management_client.py @@ -15,7 +15,13 @@ from . import models as _models from ._configuration import CommunicationServiceManagementClientConfiguration from ._serialization import Deserializer, Serializer -from .operations import CommunicationServicesOperations, DomainsOperations, EmailServicesOperations, Operations +from .operations import ( + CommunicationServicesOperations, + DomainsOperations, + EmailServicesOperations, + Operations, + SenderUsernamesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -34,13 +40,15 @@ class CommunicationServiceManagementClient: # pylint: disable=client-accepts-ap :vartype domains: azure.mgmt.communication.operations.DomainsOperations :ivar email_services: EmailServicesOperations operations :vartype email_services: azure.mgmt.communication.operations.EmailServicesOperations + :ivar sender_usernames: SenderUsernamesOperations operations + :vartype sender_usernames: azure.mgmt.communication.operations.SenderUsernamesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -57,7 +65,7 @@ def __init__( self._config = CommunicationServiceManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -69,6 +77,9 @@ def __init__( ) self.domains = DomainsOperations(self._client, self._config, self._serialize, self._deserialize) self.email_services = EmailServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sender_usernames = SenderUsernamesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -99,5 +110,5 @@ def __enter__(self) -> "CommunicationServiceManagementClient": self._client.__enter__() return self - def __exit__(self, *exc_details) -> None: + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py index e8be35d6eaaf..47678eafe719 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_configuration.py @@ -33,16 +33,16 @@ class CommunicationServiceManagementClientConfiguration(Configuration): # pylin :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: super(CommunicationServiceManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-07-01-preview"] = kwargs.pop("api_version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop("api_version", "2023-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_serialization.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_serialization.py index 2c170e28dbca..f17c068e833e 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_serialization.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_serialization.py @@ -38,7 +38,22 @@ import re import sys import codecs -from typing import Optional, Union, AnyStr, IO, Mapping +from typing import ( + Dict, + Any, + cast, + Optional, + Union, + AnyStr, + IO, + Mapping, + Callable, + TypeVar, + MutableMapping, + Type, + List, + Mapping, +) try: from urllib import quote # type: ignore @@ -48,12 +63,14 @@ import isodate # type: ignore -from typing import Dict, Any, cast - from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback +from azure.core.serialization import NULL as AzureCoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") +ModelType = TypeVar("ModelType", bound="Model") +JSON = MutableMapping[str, Any] + class RawDeserializer: @@ -277,8 +294,8 @@ class Model(object): _attribute_map: Dict[str, Dict[str, Any]] = {} _validation: Dict[str, Dict[str, Any]] = {} - def __init__(self, **kwargs): - self.additional_properties = {} + def __init__(self, **kwargs: Any) -> None: + self.additional_properties: Dict[str, Any] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -287,25 +304,25 @@ def __init__(self, **kwargs): else: setattr(self, k, kwargs[k]) - def __eq__(self, other): + def __eq__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False - def __ne__(self, other): + def __ne__(self, other: Any) -> bool: """Compare objects by comparing all attributes.""" return not self.__eq__(other) - def __str__(self): + def __str__(self) -> str: return str(self.__dict__) @classmethod - def enable_additional_properties_sending(cls): + def enable_additional_properties_sending(cls) -> None: cls._attribute_map["additional_properties"] = {"key": "", "type": "{object}"} @classmethod - def is_xml_model(cls): + def is_xml_model(cls) -> bool: try: cls._xml_map # type: ignore except AttributeError: @@ -322,7 +339,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) - def serialize(self, keep_readonly=False, **kwargs): + def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: """Return the JSON that would be sent to azure from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -336,8 +353,13 @@ def serialize(self, keep_readonly=False, **kwargs): serializer = Serializer(self._infer_class_models()) return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) - def as_dict(self, keep_readonly=True, key_transformer=attribute_transformer, **kwargs): - """Return a dict that can be JSONify using json.dump. + def as_dict( + self, + keep_readonly: bool = True, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + **kwargs: Any + ) -> JSON: + """Return a dict that can be serialized using json.dump. Advanced usage might optionally use a callback as parameter: @@ -384,7 +406,7 @@ def _infer_class_models(cls): return client_models @classmethod - def deserialize(cls, data, content_type=None): + def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. @@ -396,7 +418,12 @@ def deserialize(cls, data, content_type=None): return deserializer(cls.__name__, data, content_type=content_type) @classmethod - def from_dict(cls, data, key_extractors=None, content_type=None): + def from_dict( + cls: Type[ModelType], + data: Any, + key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + content_type: Optional[str] = None, + ) -> ModelType: """Parse a dict using given key extractor return a model. By default consider key @@ -409,8 +436,8 @@ def from_dict(cls, data, key_extractors=None, content_type=None): :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - deserializer.key_extractors = ( - [ + deserializer.key_extractors = ( # type: ignore + [ # type: ignore attribute_key_case_insensitive_extractor, rest_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, @@ -518,7 +545,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -534,7 +561,7 @@ def __init__(self, classes=None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -626,8 +653,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore - unflattened = {k: new_attr} - new_attr = unflattened + new_attr = {k: new_attr} _new_attr = new_attr _serialized = serialized @@ -656,8 +682,8 @@ def body(self, data, data_type, **kwargs): """ # Just in case this is a dict - internal_data_type = data_type.strip("[]{}") - internal_data_type = self.dependencies.get(internal_data_type, None) + internal_data_type_str = data_type.strip("[]{}") + internal_data_type = self.dependencies.get(internal_data_type_str, None) try: is_xml_model_serialization = kwargs["is_xml"] except KeyError: @@ -777,6 +803,8 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: + if data is AzureCoreNull: + return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -1161,7 +1189,8 @@ def rest_key_extractor(attr, attr_desc, data): working_data = data while "." in key: - dict_keys = _FLATTEN.split(key) + # Need the cast, as for some reasons "split" is typed as list[str | Any] + dict_keys = cast(List[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1332,7 +1361,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes=None): + def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1352,7 +1381,7 @@ def __init__(self, classes=None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies = dict(classes) if classes else {} + self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1471,7 +1500,7 @@ def _classify_target(self, target, data): Once classification has been determined, initialize object. :param str target: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. """ if target is None: return None, None @@ -1486,7 +1515,7 @@ def _classify_target(self, target, data): target = target._classify(data, self.dependencies) except AttributeError: pass # Target is not a Model, no classify - return target, target.__class__.__name__ + return target, target.__class__.__name__ # type: ignore def failsafe_deserialize(self, target_obj, data, content_type=None): """Ignores any errors encountered in deserialization, @@ -1496,7 +1525,7 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): a deserialization error. :param str target_obj: The target object type to deserialize to. - :param str/dict data: The response data to deseralize. + :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. """ try: diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_vendor.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_vendor.py index 9aad73fc743e..bd0df84f5319 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_vendor.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_vendor.py @@ -5,6 +5,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from typing import List, cast + from azure.core.pipeline.transport import HttpRequest @@ -22,6 +24,7 @@ def _format_url_section(template, **kwargs): try: return template.format(**kwargs) except KeyError as key: - formatted_components = template.split("/") + # Need the cast, as for some reasons "split" is typed as list[str | Any] + formatted_components = cast(List[str], template.split("/")) components = [c for c in formatted_components if "{}".format(key.args[0]) not in c] template = "/".join(components) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py index 2eda20789583..be0a9764bc6d 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0b2" +VERSION = "2.0.0b3" diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py index 4db65d9a1ef4..0454ad7dd12c 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_communication_service_management_client.py @@ -15,7 +15,13 @@ from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import CommunicationServiceManagementClientConfiguration -from .operations import CommunicationServicesOperations, DomainsOperations, EmailServicesOperations, Operations +from .operations import ( + CommunicationServicesOperations, + DomainsOperations, + EmailServicesOperations, + Operations, + SenderUsernamesOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -34,13 +40,15 @@ class CommunicationServiceManagementClient: # pylint: disable=client-accepts-ap :vartype domains: azure.mgmt.communication.aio.operations.DomainsOperations :ivar email_services: EmailServicesOperations operations :vartype email_services: azure.mgmt.communication.aio.operations.EmailServicesOperations + :ivar sender_usernames: SenderUsernamesOperations operations + :vartype sender_usernames: azure.mgmt.communication.aio.operations.SenderUsernamesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no @@ -57,7 +65,7 @@ def __init__( self._config = CommunicationServiceManagementClientConfiguration( credential=credential, subscription_id=subscription_id, **kwargs ) - self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -69,6 +77,9 @@ def __init__( ) self.domains = DomainsOperations(self._client, self._config, self._serialize, self._deserialize) self.email_services = EmailServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.sender_usernames = SenderUsernamesOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -99,5 +110,5 @@ async def __aenter__(self) -> "CommunicationServiceManagementClient": await self._client.__aenter__() return self - async def __aexit__(self, *exc_details) -> None: + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py index 4a66c9727dda..504feb8681bf 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/_configuration.py @@ -33,16 +33,16 @@ class CommunicationServiceManagementClientConfiguration(Configuration): # pylin :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-01-preview". Note that overriding + :keyword api_version: Api Version. Default value is "2023-03-01-preview". Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: super(CommunicationServiceManagementClientConfiguration, self).__init__(**kwargs) - api_version: Literal["2022-07-01-preview"] = kwargs.pop("api_version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop("api_version", "2023-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/__init__.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/__init__.py index 474b432d390b..0c55fb0d31b2 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/__init__.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/__init__.py @@ -10,6 +10,7 @@ from ._communication_services_operations import CommunicationServicesOperations from ._domains_operations import DomainsOperations from ._email_services_operations import EmailServicesOperations +from ._sender_usernames_operations import SenderUsernamesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -20,6 +21,7 @@ "CommunicationServicesOperations", "DomainsOperations", "EmailServicesOperations", + "SenderUsernamesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_services_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_services_operations.py index 9f1a32a5d1a2..508414442e97 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_services_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_communication_services_operations.py @@ -121,8 +121,8 @@ async def check_name_availability( Checks that the CommunicationService name is valid and is not already in use. - :param name_availability_parameters: Parameters supplied to the operation. Is either a model - type or a IO type. Required. + :param name_availability_parameters: Parameters supplied to the operation. Is either a + NameAvailabilityParameters type or a IO type. Required. :type name_availability_parameters: ~azure.mgmt.communication.models.NameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -144,7 +144,7 @@ async def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -171,8 +171,9 @@ async def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -274,7 +275,7 @@ async def link_notification_hub( :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str :param link_notification_hub_parameters: Parameters supplied to the operation. Is either a - model type or a IO type. Default value is None. + LinkNotificationHubParameters type or a IO type. Default value is None. :type link_notification_hub_parameters: ~azure.mgmt.communication.models.LinkNotificationHubParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -296,7 +297,7 @@ async def link_notification_hub( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -328,8 +329,9 @@ async def link_notification_hub( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -366,7 +368,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Communic _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceResourceList] = kwargs.pop("cls", None) @@ -420,8 +422,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -459,7 +462,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceResourceList] = kwargs.pop("cls", None) @@ -514,8 +517,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -532,86 +536,8 @@ async def get_next(next_link=None): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices" } - async def _update_initial( - self, - resource_group_name: str, - communication_service_name: str, - parameters: Union[_models.CommunicationServiceResourceUpdate, IO], - **kwargs: Any - ) -> _models.CommunicationServiceResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommunicationServiceResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CommunicationServiceResourceUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) - - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" - } - @overload - async def begin_update( + async def update( self, resource_group_name: str, communication_service_name: str, @@ -619,7 +545,7 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationServiceResource]: + ) -> _models.CommunicationServiceResource: """Update. Operation to update an existing CommunicationService. @@ -635,22 +561,13 @@ async def begin_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CommunicationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communication.models.CommunicationServiceResource] + :return: CommunicationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_update( + async def update( self, resource_group_name: str, communication_service_name: str, @@ -658,7 +575,7 @@ async def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationServiceResource]: + ) -> _models.CommunicationServiceResource: """Update. Operation to update an existing CommunicationService. @@ -674,28 +591,19 @@ async def begin_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CommunicationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communication.models.CommunicationServiceResource] + :return: CommunicationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_update( + async def update( self, resource_group_name: str, communication_service_name: str, parameters: Union[_models.CommunicationServiceResourceUpdate, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationServiceResource]: + ) -> _models.CommunicationServiceResource: """Update. Operation to update an existing CommunicationService. @@ -705,76 +613,77 @@ async def begin_update( :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str - :param parameters: Parameters for the update operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the update operation. Is either a + CommunicationServiceResourceUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.CommunicationServiceResourceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CommunicationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communication.models.CommunicationServiceResource] + :return: CommunicationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CommunicationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _json = self._serialize.body(parameters, "CommunicationServiceResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + communication_service_name=communication_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized - begin_update.metadata = { + update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" } @@ -807,7 +716,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceResource] = kwargs.pop("cls", None) @@ -824,8 +733,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -864,7 +774,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -893,8 +803,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1019,8 +930,8 @@ async def begin_create_or_update( :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str - :param parameters: Parameters for the create or update operation. Is either a model type or a - IO type. Required. + :param parameters: Parameters for the create or update operation. Is either a + CommunicationServiceResource type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.CommunicationServiceResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1042,7 +953,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1106,7 +1017,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1123,8 +1034,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1173,7 +1085,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1246,7 +1158,7 @@ async def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceKeys] = kwargs.pop("cls", None) @@ -1263,8 +1175,9 @@ async def list_keys( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1285,77 +1198,8 @@ async def list_keys( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys" } - async def _regenerate_key_initial( - self, - resource_group_name: str, - communication_service_name: str, - parameters: Union[_models.RegenerateKeyParameters, IO], - **kwargs: Any - ) -> _models.CommunicationServiceKeys: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommunicationServiceKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RegenerateKeyParameters") - - request = build_regenerate_key_request( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._regenerate_key_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunicationServiceKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _regenerate_key_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey" - } - @overload - async def begin_regenerate_key( + async def regenerate_key( self, resource_group_name: str, communication_service_name: str, @@ -1363,7 +1207,7 @@ async def begin_regenerate_key( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationServiceKeys]: + ) -> _models.CommunicationServiceKeys: """Regenerate Key. Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated @@ -1380,22 +1224,13 @@ async def begin_regenerate_key( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CommunicationServiceKeys or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communication.models.CommunicationServiceKeys] + :return: CommunicationServiceKeys or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceKeys :raises ~azure.core.exceptions.HttpResponseError: """ @overload - async def begin_regenerate_key( + async def regenerate_key( self, resource_group_name: str, communication_service_name: str, @@ -1403,7 +1238,7 @@ async def begin_regenerate_key( *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationServiceKeys]: + ) -> _models.CommunicationServiceKeys: """Regenerate Key. Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated @@ -1420,28 +1255,19 @@ async def begin_regenerate_key( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CommunicationServiceKeys or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communication.models.CommunicationServiceKeys] + :return: CommunicationServiceKeys or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceKeys :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async - async def begin_regenerate_key( + async def regenerate_key( self, resource_group_name: str, communication_service_name: str, parameters: Union[_models.RegenerateKeyParameters, IO], **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationServiceKeys]: + ) -> _models.CommunicationServiceKeys: """Regenerate Key. Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated @@ -1452,75 +1278,76 @@ async def begin_regenerate_key( :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str - :param parameters: Parameter that describes the Regenerate Key Operation. Is either a model - type or a IO type. Required. + :param parameters: Parameter that describes the Regenerate Key Operation. Is either a + RegenerateKeyParameters type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.RegenerateKeyParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CommunicationServiceKeys or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.communication.models.CommunicationServiceKeys] + :return: CommunicationServiceKeys or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceKeys :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CommunicationServiceKeys] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._regenerate_key_initial( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationServiceKeys", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return AsyncLROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _json = self._serialize.body(parameters, "RegenerateKeyParameters") + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + communication_service_name=communication_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CommunicationServiceKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized - begin_regenerate_key.metadata = { + regenerate_key.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey" } diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_domains_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_domains_operations.py index ed5fbf7a02b0..1207deeb618d 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_domains_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_domains_operations.py @@ -99,7 +99,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DomainResource] = kwargs.pop("cls", None) @@ -117,8 +117,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -158,7 +159,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -188,8 +189,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -324,8 +326,8 @@ async def begin_create_or_update( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Parameters for the create or update operation. Is either a model type or a - IO type. Required. + :param parameters: Parameters for the create or update operation. Is either a DomainResource + type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.DomainResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -346,7 +348,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -411,7 +413,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -429,8 +431,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -481,7 +484,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -545,7 +548,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -575,8 +578,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -708,8 +712,8 @@ async def begin_update( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Parameters for the update operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the update operation. Is either a + UpdateDomainRequestParameters type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.UpdateDomainRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -730,7 +734,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -803,7 +807,7 @@ def list_by_email_service_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DomainResourceList] = kwargs.pop("cls", None) @@ -859,8 +863,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -896,7 +901,7 @@ async def _initiate_verification_initial( # pylint: disable=inconsistent-return _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -926,8 +931,9 @@ async def _initiate_verification_initial( # pylint: disable=inconsistent-return request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1047,8 +1053,8 @@ async def begin_initiate_verification( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Type of verification to be initiated. Is either a model type or a IO type. - Required. + :param parameters: Type of verification to be initiated. Is either a VerificationParameter type + or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.VerificationParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1068,7 +1074,7 @@ async def begin_initiate_verification( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1135,7 +1141,7 @@ async def _cancel_verification_initial( # pylint: disable=inconsistent-return-s _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1165,8 +1171,9 @@ async def _cancel_verification_initial( # pylint: disable=inconsistent-return-s request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1286,8 +1293,8 @@ async def begin_cancel_verification( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Type of verification to be canceled. Is either a model type or a IO type. - Required. + :param parameters: Type of verification to be canceled. Is either a VerificationParameter type + or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.VerificationParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1307,7 +1314,7 @@ async def begin_cancel_verification( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_email_services_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_email_services_operations.py index 9145013d796c..483709979f50 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_email_services_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_email_services_operations.py @@ -97,7 +97,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EmailServiceResource] = kwargs.pop("cls", None) @@ -114,8 +114,9 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -154,7 +155,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -183,8 +184,9 @@ async def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -309,8 +311,8 @@ async def begin_create_or_update( :type resource_group_name: str :param email_service_name: The name of the EmailService resource. Required. :type email_service_name: str - :param parameters: Parameters for the create or update operation. Is either a model type or a - IO type. Required. + :param parameters: Parameters for the create or update operation. Is either a + EmailServiceResource type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.EmailServiceResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -332,7 +334,7 @@ async def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -396,7 +398,7 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -413,8 +415,9 @@ async def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -463,7 +466,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -525,7 +528,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -554,8 +557,9 @@ async def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -680,8 +684,8 @@ async def begin_update( :type resource_group_name: str :param email_service_name: The name of the EmailService resource. Required. :type email_service_name: str - :param parameters: Parameters for the update operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the update operation. Is either a EmailServiceResourceUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.EmailServiceResourceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -703,7 +707,7 @@ async def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -769,7 +773,7 @@ def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.EmailSer _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EmailServiceResourceList] = kwargs.pop("cls", None) @@ -823,8 +827,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -862,7 +867,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EmailServiceResourceList] = kwargs.pop("cls", None) @@ -917,8 +922,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -957,7 +963,7 @@ async def list_verified_exchange_online_domains(self, **kwargs: Any) -> List[str _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[List[str]] = kwargs.pop("cls", None) @@ -972,8 +978,9 @@ async def list_verified_exchange_online_domains(self, **kwargs: Any) -> List[str request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py index 238cec8a168b..79d2ec3560b8 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_operations.py @@ -71,7 +71,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) @@ -124,8 +124,9 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_sender_usernames_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_sender_usernames_operations.py new file mode 100644 index 000000000000..e431f8a11da6 --- /dev/null +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/aio/operations/_sender_usernames_operations.py @@ -0,0 +1,489 @@ +# pylint: disable=too-many-lines +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._sender_usernames_operations import ( + build_create_or_update_request, + build_delete_request, + build_get_request, + build_list_by_domains_request, +) + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SenderUsernamesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.communication.aio.CommunicationServiceManagementClient`'s + :attr:`sender_usernames` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_domains( + self, resource_group_name: str, email_service_name: str, domain_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SenderUsernameResource"]: + """ListBy_Domains. + + List all valid sender usernames for a domains resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SenderUsernameResource or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.communication.models.SenderUsernameResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SenderUsernameResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_domains_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_domains.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SenderUsernameResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + list_by_domains.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames" + } + + @distributed_trace_async + async def get( + self, resource_group_name: str, email_service_name: str, domain_name: str, sender_username: str, **kwargs: Any + ) -> _models.SenderUsernameResource: + """Get. + + Get a valid sender username for a domains resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SenderUsernameResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + sender_username=sender_username, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SenderUsernameResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" + } + + @overload + async def create_or_update( + self, + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + parameters: _models.SenderUsernameResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SenderUsernameResource: + """Create Or Update. + + Add a new SenderUsername resource under the parent Domains resource or update an existing + SenderUsername resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: ~azure.mgmt.communication.models.SenderUsernameResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SenderUsernameResource: + """Create Or Update. + + Add a new SenderUsername resource under the parent Domains resource or update an existing + SenderUsername resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + parameters: Union[_models.SenderUsernameResource, IO], + **kwargs: Any + ) -> _models.SenderUsernameResource: + """Create Or Update. + + Add a new SenderUsername resource under the parent Domains resource or update an existing + SenderUsername resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :param parameters: Parameters for the create or update operation. Is either a + SenderUsernameResource type or a IO type. Required. + :type parameters: ~azure.mgmt.communication.models.SenderUsernameResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SenderUsernameResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SenderUsernameResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + sender_username=sender_username, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SenderUsernameResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SenderUsernameResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" + } + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, email_service_name: str, domain_name: str, sender_username: str, **kwargs: Any + ) -> None: + """Delete. + + Operation to delete a SenderUsernames resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + sender_username=sender_username, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" + } diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py index 97fefe38c873..30d34b58eb28 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/__init__.py @@ -29,8 +29,11 @@ from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import OperationListResult +from ._models_py3 import ProxyResource from ._models_py3 import RegenerateKeyParameters from ._models_py3 import Resource +from ._models_py3 import SenderUsernameResource +from ._models_py3 import SenderUsernameResourceCollection from ._models_py3 import SystemData from ._models_py3 import TaggedResource from ._models_py3 import TrackedResource @@ -47,6 +50,7 @@ from ._communication_service_management_client_enums import EmailServicesProvisioningState from ._communication_service_management_client_enums import KeyType from ._communication_service_management_client_enums import Origin +from ._communication_service_management_client_enums import ProvisioningState from ._communication_service_management_client_enums import UserEngagementTracking from ._communication_service_management_client_enums import VerificationStatus from ._communication_service_management_client_enums import VerificationType @@ -78,8 +82,11 @@ "Operation", "OperationDisplay", "OperationListResult", + "ProxyResource", "RegenerateKeyParameters", "Resource", + "SenderUsernameResource", + "SenderUsernameResourceCollection", "SystemData", "TaggedResource", "TrackedResource", @@ -95,6 +102,7 @@ "EmailServicesProvisioningState", "KeyType", "Origin", + "ProvisioningState", "UserEngagementTracking", "VerificationStatus", "VerificationType", diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py index 6122ce2f3402..ebfb8d80e262 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_communication_service_management_client_enums.py @@ -99,6 +99,20 @@ class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): USER_SYSTEM = "user,system" +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the resource. Unknown is the default state for Communication Services.""" + + UNKNOWN = "Unknown" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + RUNNING = "Running" + CREATING = "Creating" + UPDATING = "Updating" + DELETING = "Deleting" + MOVING = "Moving" + + class UserEngagementTracking(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes whether user engagement tracking is enabled or disabled.""" diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py index 99c88fbe8267..3c79cdd08439 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/models/_models_py3.py @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -31,7 +31,7 @@ class CheckNameAvailabilityRequest(_serialization.Model): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the resource for which availability needs to be checked. :paramtype name: str @@ -67,8 +67,8 @@ def __init__( name_available: Optional[bool] = None, reason: Optional[Union[str, "_models.CheckNameAvailabilityReason"]] = None, message: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword name_available: Indicates if the resource name is available. :paramtype name_available: bool @@ -113,8 +113,8 @@ def __init__( secondary_key: Optional[str] = None, primary_connection_string: Optional[str] = None, secondary_connection_string: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword primary_key: The primary access key. :paramtype primary_key: str @@ -139,8 +139,8 @@ class Resource(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -166,7 +166,7 @@ class Resource(_serialization.Model): "system_data": {"key": "systemData", "type": "SystemData"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.id = None @@ -176,14 +176,15 @@ def __init__(self, **kwargs): class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + """The resource model definition for an Azure Resource Manager tracked top level resource which + has 'tags' and a 'location'. 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. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -216,7 +217,7 @@ class TrackedResource(Resource): "location": {"key": "location", "type": "str"}, } - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -235,8 +236,8 @@ class CommunicationServiceResource(TrackedResource): # pylint: disable=too-many All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -305,8 +306,8 @@ def __init__( tags: Optional[Dict[str, str]] = None, data_location: Optional[str] = None, linked_domains: Optional[List[str]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -347,8 +348,8 @@ def __init__( *, value: Optional[List["_models.CommunicationServiceResource"]] = None, next_link: Optional[str] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword value: List of CommunicationService. :paramtype value: list[~azure.mgmt.communication.models.CommunicationServiceResource] @@ -373,7 +374,7 @@ class TaggedResource(_serialization.Model): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Tags of the service which is a list of key value pairs that describe the resource. @@ -397,7 +398,9 @@ class CommunicationServiceResourceUpdate(TaggedResource): "linked_domains": {"key": "properties.linkedDomains", "type": "[str]"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, linked_domains: Optional[List[str]] = None, **kwargs): + def __init__( + self, *, tags: Optional[Dict[str, str]] = None, linked_domains: Optional[List[str]] = None, **kwargs: Any + ) -> None: """ :keyword tags: Tags of the service which is a list of key value pairs that describe the resource. @@ -439,7 +442,7 @@ class DnsRecord(_serialization.Model): "ttl": {"key": "ttl", "type": "int"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -479,8 +482,8 @@ def __init__( dkim: Optional["_models.DnsRecord"] = None, dkim2: Optional["_models.DnsRecord"] = None, dmarc: Optional["_models.DnsRecord"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain: A class that represents a VerificationStatus record. :paramtype domain: ~azure.mgmt.communication.models.DnsRecord @@ -532,8 +535,8 @@ def __init__( dkim: Optional["_models.VerificationStatusRecord"] = None, dkim2: Optional["_models.VerificationStatusRecord"] = None, dmarc: Optional["_models.VerificationStatusRecord"] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword domain: A class that represents a VerificationStatus record. :paramtype domain: ~azure.mgmt.communication.models.VerificationStatusRecord @@ -561,8 +564,8 @@ class DomainResource(TrackedResource): # pylint: disable=too-many-instance-attr All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -596,9 +599,6 @@ class DomainResource(TrackedResource): # pylint: disable=too-many-instance-attr :ivar verification_records: List of DnsRecord. :vartype verification_records: ~azure.mgmt.communication.models.DomainPropertiesVerificationRecords - :ivar valid_sender_usernames: Collection of valid sender usernames. This is a key-value pair - where key=username and value=display name. - :vartype valid_sender_usernames: dict[str, str] :ivar user_engagement_tracking: Describes whether user engagement tracking is enabled or disabled. Known values are: "Disabled" and "Enabled". :vartype user_engagement_tracking: str or @@ -636,7 +636,6 @@ class DomainResource(TrackedResource): # pylint: disable=too-many-instance-attr "key": "properties.verificationRecords", "type": "DomainPropertiesVerificationRecords", }, - "valid_sender_usernames": {"key": "properties.validSenderUsernames", "type": "{str}"}, "user_engagement_tracking": {"key": "properties.userEngagementTracking", "type": "str"}, } @@ -646,10 +645,9 @@ def __init__( location: str, tags: Optional[Dict[str, str]] = None, domain_management: Optional[Union[str, "_models.DomainManagement"]] = None, - valid_sender_usernames: Optional[Dict[str, str]] = None, user_engagement_tracking: Optional[Union[str, "_models.UserEngagementTracking"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -658,9 +656,6 @@ def __init__( :keyword domain_management: Describes how a Domains resource is being managed. Known values are: "AzureManaged", "CustomerManaged", and "CustomerManagedInExchangeOnline". :paramtype domain_management: str or ~azure.mgmt.communication.models.DomainManagement - :keyword valid_sender_usernames: Collection of valid sender usernames. This is a key-value pair - where key=username and value=display name. - :paramtype valid_sender_usernames: dict[str, str] :keyword user_engagement_tracking: Describes whether user engagement tracking is enabled or disabled. Known values are: "Disabled" and "Enabled". :paramtype user_engagement_tracking: str or @@ -674,7 +669,6 @@ def __init__( self.domain_management = domain_management self.verification_states = None self.verification_records = None - self.valid_sender_usernames = valid_sender_usernames self.user_engagement_tracking = user_engagement_tracking @@ -694,8 +688,8 @@ class DomainResourceList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.DomainResource"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, *, value: Optional[List["_models.DomainResource"]] = None, next_link: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword value: List of Domains resource. :paramtype value: list[~azure.mgmt.communication.models.DomainResource] @@ -716,8 +710,8 @@ class EmailServiceResource(TrackedResource): All required parameters must be populated in order to send to Azure. - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -760,8 +754,13 @@ class EmailServiceResource(TrackedResource): } def __init__( - self, *, location: str, tags: Optional[Dict[str, str]] = None, data_location: Optional[str] = None, **kwargs - ): + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + data_location: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword tags: Resource tags. :paramtype tags: dict[str, str] @@ -791,8 +790,12 @@ class EmailServiceResourceList(_serialization.Model): } def __init__( - self, *, value: Optional[List["_models.EmailServiceResource"]] = None, next_link: Optional[str] = None, **kwargs - ): + self, + *, + value: Optional[List["_models.EmailServiceResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: """ :keyword value: List of EmailService. :paramtype value: list[~azure.mgmt.communication.models.EmailServiceResource] @@ -817,7 +820,7 @@ class EmailServiceResourceUpdate(TaggedResource): "tags": {"key": "tags", "type": "{str}"}, } - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs): + def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: """ :keyword tags: Tags of the service which is a list of key value pairs that describe the resource. @@ -847,7 +850,7 @@ class ErrorAdditionalInfo(_serialization.Model): "info": {"key": "info", "type": "object"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.type = None @@ -887,7 +890,7 @@ class ErrorDetail(_serialization.Model): "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.code = None @@ -898,7 +901,8 @@ def __init__(self, **kwargs): class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). + """Common error response for all Azure Resource Manager APIs to return error details for failed + operations. (This also follows the OData error response format.). :ivar error: The error object. :vartype error: ~azure.mgmt.communication.models.ErrorDetail @@ -908,7 +912,7 @@ class ErrorResponse(_serialization.Model): "error": {"key": "error", "type": "ErrorDetail"}, } - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs): + def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. :paramtype error: ~azure.mgmt.communication.models.ErrorDetail @@ -928,7 +932,7 @@ class LinkedNotificationHub(_serialization.Model): "resource_id": {"key": "resourceId", "type": "str"}, } - def __init__(self, *, resource_id: Optional[str] = None, **kwargs): + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: """ :keyword resource_id: The resource ID of the notification hub. :paramtype resource_id: str @@ -958,7 +962,7 @@ class LinkNotificationHubParameters(_serialization.Model): "connection_string": {"key": "connectionString", "type": "str"}, } - def __init__(self, *, resource_id: str, connection_string: str, **kwargs): + def __init__(self, *, resource_id: str, connection_string: str, **kwargs: Any) -> None: """ :keyword resource_id: The resource ID of the notification hub. Required. :paramtype resource_id: str @@ -984,7 +988,7 @@ class NameAvailabilityParameters(CheckNameAvailabilityRequest): "type": {"key": "type", "type": "str"}, } - def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs): + def __init__(self, *, name: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: """ :keyword name: The name of the resource for which availability needs to be checked. :paramtype name: str @@ -1031,7 +1035,7 @@ class Operation(_serialization.Model): "action_type": {"key": "actionType", "type": "str"}, } - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs): + def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. :paramtype display: ~azure.mgmt.communication.models.OperationDisplay @@ -1077,7 +1081,7 @@ class OperationDisplay(_serialization.Model): "description": {"key": "description", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.provider = None @@ -1087,7 +1091,8 @@ def __init__(self, **kwargs): class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link + to get the next set of results. Variables are only populated by the server, and will be ignored when sending a request. @@ -1107,13 +1112,51 @@ class OperationListResult(_serialization.Model): "next_link": {"key": "nextLink", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.value = None self.next_link = None +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have + tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.communication.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + + class RegenerateKeyParameters(_serialization.Model): """Parameters describes the request to regenerate access keys. @@ -1126,7 +1169,7 @@ class RegenerateKeyParameters(_serialization.Model): "key_type": {"key": "keyType", "type": "str"}, } - def __init__(self, *, key_type: Optional[Union[str, "_models.KeyType"]] = None, **kwargs): + def __init__(self, *, key_type: Optional[Union[str, "_models.KeyType"]] = None, **kwargs: Any) -> None: """ :keyword key_type: The keyType to regenerate. Must be either 'primary' or 'secondary'(case-insensitive). Known values are: "Primary" and "Secondary". @@ -1136,6 +1179,101 @@ def __init__(self, *, key_type: Optional[Union[str, "_models.KeyType"]] = None, self.key_type = key_type +class SenderUsernameResource(ProxyResource): + """A class representing a SenderUsername resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.communication.models.SystemData + :ivar data_location: The location where the SenderUsername resource data is stored at rest. + :vartype data_location: str + :ivar username: A sender senderUsername to be used when sending emails. + :vartype username: str + :ivar display_name: The display name for the senderUsername. + :vartype display_name: str + :ivar provisioning_state: Provisioning state of the resource. Unknown is the default state for + Communication Services. Known values are: "Unknown", "Succeeded", "Failed", "Canceled", + "Running", "Creating", "Updating", "Deleting", and "Moving". + :vartype provisioning_state: str or ~azure.mgmt.communication.models.ProvisioningState + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "data_location": {"readonly": True}, + "provisioning_state": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "data_location": {"key": "properties.dataLocation", "type": "str"}, + "username": {"key": "properties.username", "type": "str"}, + "display_name": {"key": "properties.displayName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + } + + def __init__(self, *, username: Optional[str] = None, display_name: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword username: A sender senderUsername to be used when sending emails. + :paramtype username: str + :keyword display_name: The display name for the senderUsername. + :paramtype display_name: str + """ + super().__init__(**kwargs) + self.data_location = None + self.username = username + self.display_name = display_name + self.provisioning_state = None + + +class SenderUsernameResourceCollection(_serialization.Model): + """A class representing a Domains SenderUsernames collection. + + :ivar value: List of SenderUsernames. + :vartype value: list[~azure.mgmt.communication.models.SenderUsernameResource] + :ivar next_link: The URL the client should use to fetch the next page (per server side paging). + :vartype next_link: str + """ + + _attribute_map = { + "value": {"key": "value", "type": "[SenderUsernameResource]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, + *, + value: Optional[List["_models.SenderUsernameResource"]] = None, + next_link: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword value: List of SenderUsernames. + :paramtype value: list[~azure.mgmt.communication.models.SenderUsernameResource] + :keyword next_link: The URL the client should use to fetch the next page (per server side + paging). + :paramtype next_link: str + """ + super().__init__(**kwargs) + self.value = value + self.next_link = next_link + + class SystemData(_serialization.Model): """Metadata pertaining to creation and last modification of the resource. @@ -1173,8 +1311,8 @@ def __init__( last_modified_by: Optional[str] = None, last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, last_modified_at: Optional[datetime.datetime] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword created_by: The identity that created the resource. :paramtype created_by: str @@ -1205,9 +1343,6 @@ class UpdateDomainRequestParameters(TaggedResource): :ivar tags: Tags of the service which is a list of key value pairs that describe the resource. :vartype tags: dict[str, str] - :ivar valid_sender_usernames: Collection of valid sender usernames. This is a key-value pair - where key=username and value=display name. - :vartype valid_sender_usernames: dict[str, str] :ivar user_engagement_tracking: Describes whether user engagement tracking is enabled or disabled. Known values are: "Disabled" and "Enabled". :vartype user_engagement_tracking: str or @@ -1216,7 +1351,6 @@ class UpdateDomainRequestParameters(TaggedResource): _attribute_map = { "tags": {"key": "tags", "type": "{str}"}, - "valid_sender_usernames": {"key": "properties.validSenderUsernames", "type": "{str}"}, "user_engagement_tracking": {"key": "properties.userEngagementTracking", "type": "str"}, } @@ -1224,24 +1358,19 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - valid_sender_usernames: Optional[Dict[str, str]] = None, user_engagement_tracking: Optional[Union[str, "_models.UserEngagementTracking"]] = None, - **kwargs - ): + **kwargs: Any + ) -> None: """ :keyword tags: Tags of the service which is a list of key value pairs that describe the resource. :paramtype tags: dict[str, str] - :keyword valid_sender_usernames: Collection of valid sender usernames. This is a key-value pair - where key=username and value=display name. - :paramtype valid_sender_usernames: dict[str, str] :keyword user_engagement_tracking: Describes whether user engagement tracking is enabled or disabled. Known values are: "Disabled" and "Enabled". :paramtype user_engagement_tracking: str or ~azure.mgmt.communication.models.UserEngagementTracking """ super().__init__(tags=tags, **kwargs) - self.valid_sender_usernames = valid_sender_usernames self.user_engagement_tracking = user_engagement_tracking @@ -1263,7 +1392,7 @@ class VerificationParameter(_serialization.Model): "verification_type": {"key": "verificationType", "type": "str"}, } - def __init__(self, *, verification_type: Union[str, "_models.VerificationType"], **kwargs): + def __init__(self, *, verification_type: Union[str, "_models.VerificationType"], **kwargs: Any) -> None: """ :keyword verification_type: Type of verification. Required. Known values are: "Domain", "SPF", "DKIM", "DKIM2", and "DMARC". @@ -1297,7 +1426,7 @@ class VerificationStatusRecord(_serialization.Model): "error_code": {"key": "errorCode", "type": "str"}, } - def __init__(self, **kwargs): + def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) self.status = None diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/__init__.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/__init__.py index 474b432d390b..0c55fb0d31b2 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/__init__.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/__init__.py @@ -10,6 +10,7 @@ from ._communication_services_operations import CommunicationServicesOperations from ._domains_operations import DomainsOperations from ._email_services_operations import EmailServicesOperations +from ._sender_usernames_operations import SenderUsernamesOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -20,6 +21,7 @@ "CommunicationServicesOperations", "DomainsOperations", "EmailServicesOperations", + "SenderUsernamesOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_services_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_services_operations.py index 39870250846f..9e926868fd55 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_services_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_communication_services_operations.py @@ -47,8 +47,8 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -58,7 +58,7 @@ def build_check_name_availability_request(subscription_id: str, **kwargs: Any) - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -80,8 +80,8 @@ def build_link_notification_hub_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -92,7 +92,7 @@ def build_link_notification_hub_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/linkNotificationHub", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -102,7 +102,7 @@ def build_link_notification_hub_request( "str", max_length=63, min_length=1, - pattern=r"^[-\w]+$", + pattern=r"^[a-zA-Z0-9-]+$", ), } @@ -123,8 +123,8 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -133,7 +133,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/communicationServices" ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -151,8 +151,8 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -162,7 +162,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -185,8 +185,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -197,7 +197,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,7 +207,7 @@ def build_update_request( "str", max_length=63, min_length=1, - pattern=r"^[-\w]+$", + pattern=r"^[a-zA-Z0-9-]+$", ), } @@ -230,8 +230,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -241,7 +241,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -251,7 +251,7 @@ def build_get_request( "str", max_length=63, min_length=1, - pattern=r"^[-\w]+$", + pattern=r"^[a-zA-Z0-9-]+$", ), } @@ -272,8 +272,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -284,7 +284,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -294,7 +294,7 @@ def build_create_or_update_request( "str", max_length=63, min_length=1, - pattern=r"^[-\w]+$", + pattern=r"^[a-zA-Z0-9-]+$", ), } @@ -317,8 +317,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -328,7 +328,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -338,7 +338,7 @@ def build_delete_request( "str", max_length=63, min_length=1, - pattern=r"^[-\w]+$", + pattern=r"^[a-zA-Z0-9-]+$", ), } @@ -359,8 +359,8 @@ def build_list_keys_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -370,7 +370,7 @@ def build_list_keys_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -380,7 +380,7 @@ def build_list_keys_request( "str", max_length=63, min_length=1, - pattern=r"^[-\w]+$", + pattern=r"^[a-zA-Z0-9-]+$", ), } @@ -401,8 +401,8 @@ def build_regenerate_key_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -413,7 +413,7 @@ def build_regenerate_key_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -423,7 +423,7 @@ def build_regenerate_key_request( "str", max_length=63, min_length=1, - pattern=r"^[-\w]+$", + pattern=r"^[a-zA-Z0-9-]+$", ), } @@ -509,8 +509,8 @@ def check_name_availability( Checks that the CommunicationService name is valid and is not already in use. - :param name_availability_parameters: Parameters supplied to the operation. Is either a model - type or a IO type. Required. + :param name_availability_parameters: Parameters supplied to the operation. Is either a + NameAvailabilityParameters type or a IO type. Required. :type name_availability_parameters: ~azure.mgmt.communication.models.NameAvailabilityParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -532,7 +532,7 @@ def check_name_availability( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -559,8 +559,9 @@ def check_name_availability( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -662,7 +663,7 @@ def link_notification_hub( :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str :param link_notification_hub_parameters: Parameters supplied to the operation. Is either a - model type or a IO type. Default value is None. + LinkNotificationHubParameters type or a IO type. Default value is None. :type link_notification_hub_parameters: ~azure.mgmt.communication.models.LinkNotificationHubParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. @@ -684,7 +685,7 @@ def link_notification_hub( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -716,8 +717,9 @@ def link_notification_hub( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -754,7 +756,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Communication _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceResourceList] = kwargs.pop("cls", None) @@ -808,8 +810,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -847,7 +850,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceResourceList] = kwargs.pop("cls", None) @@ -902,8 +905,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -920,86 +924,8 @@ def get_next(next_link=None): "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices" } - def _update_initial( - self, - resource_group_name: str, - communication_service_name: str, - parameters: Union[_models.CommunicationServiceResourceUpdate, IO], - **kwargs: Any - ) -> _models.CommunicationServiceResource: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommunicationServiceResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "CommunicationServiceResourceUpdate") - - request = build_update_request( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._update_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) - - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - _update_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" - } - @overload - def begin_update( + def update( self, resource_group_name: str, communication_service_name: str, @@ -1007,7 +933,7 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommunicationServiceResource]: + ) -> _models.CommunicationServiceResource: """Update. Operation to update an existing CommunicationService. @@ -1023,22 +949,13 @@ def begin_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CommunicationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.communication.models.CommunicationServiceResource] + :return: CommunicationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_update( + def update( self, resource_group_name: str, communication_service_name: str, @@ -1046,7 +963,7 @@ def begin_update( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommunicationServiceResource]: + ) -> _models.CommunicationServiceResource: """Update. Operation to update an existing CommunicationService. @@ -1062,28 +979,19 @@ def begin_update( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CommunicationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.communication.models.CommunicationServiceResource] + :return: CommunicationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_update( + def update( self, resource_group_name: str, communication_service_name: str, parameters: Union[_models.CommunicationServiceResourceUpdate, IO], **kwargs: Any - ) -> LROPoller[_models.CommunicationServiceResource]: + ) -> _models.CommunicationServiceResource: """Update. Operation to update an existing CommunicationService. @@ -1093,75 +1001,77 @@ def begin_update( :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str - :param parameters: Parameters for the update operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the update operation. Is either a + CommunicationServiceResourceUpdate type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.CommunicationServiceResourceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CommunicationServiceResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.communication.models.CommunicationServiceResource] + :return: CommunicationServiceResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceResource :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CommunicationServiceResource] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _json = self._serialize.body(parameters, "CommunicationServiceResourceUpdate") + + request = build_update_request( + resource_group_name=resource_group_name, + communication_service_name=communication_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CommunicationServiceResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized - begin_update.metadata = { + update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}" } @@ -1194,7 +1104,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceResource] = kwargs.pop("cls", None) @@ -1211,8 +1121,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1251,7 +1162,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1280,8 +1191,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1406,8 +1318,8 @@ def begin_create_or_update( :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str - :param parameters: Parameters for the create or update operation. Is either a model type or a - IO type. Required. + :param parameters: Parameters for the create or update operation. Is either a + CommunicationServiceResource type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.CommunicationServiceResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1429,7 +1341,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1492,7 +1404,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1509,8 +1421,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1557,7 +1470,7 @@ def begin_delete(self, resource_group_name: str, communication_service_name: str _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -1630,7 +1543,7 @@ def list_keys( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.CommunicationServiceKeys] = kwargs.pop("cls", None) @@ -1647,8 +1560,9 @@ def list_keys( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1669,77 +1583,8 @@ def list_keys( "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/listKeys" } - def _regenerate_key_initial( - self, - resource_group_name: str, - communication_service_name: str, - parameters: Union[_models.RegenerateKeyParameters, IO], - **kwargs: Any - ) -> _models.CommunicationServiceKeys: - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", self._config.api_version) - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CommunicationServiceKeys] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IO, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "RegenerateKeyParameters") - - request = build_regenerate_key_request( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - template_url=self._regenerate_key_initial.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs - ) - - response = pipeline_response.http_response - - 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.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CommunicationServiceKeys", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized - - _regenerate_key_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey" - } - @overload - def begin_regenerate_key( + def regenerate_key( self, resource_group_name: str, communication_service_name: str, @@ -1747,7 +1592,7 @@ def begin_regenerate_key( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommunicationServiceKeys]: + ) -> _models.CommunicationServiceKeys: """Regenerate Key. Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated @@ -1764,22 +1609,13 @@ def begin_regenerate_key( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CommunicationServiceKeys or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.communication.models.CommunicationServiceKeys] + :return: CommunicationServiceKeys or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceKeys :raises ~azure.core.exceptions.HttpResponseError: """ @overload - def begin_regenerate_key( + def regenerate_key( self, resource_group_name: str, communication_service_name: str, @@ -1787,7 +1623,7 @@ def begin_regenerate_key( *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.CommunicationServiceKeys]: + ) -> _models.CommunicationServiceKeys: """Regenerate Key. Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated @@ -1804,28 +1640,19 @@ def begin_regenerate_key( Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CommunicationServiceKeys or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.communication.models.CommunicationServiceKeys] + :return: CommunicationServiceKeys or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceKeys :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace - def begin_regenerate_key( + def regenerate_key( self, resource_group_name: str, communication_service_name: str, parameters: Union[_models.RegenerateKeyParameters, IO], **kwargs: Any - ) -> LROPoller[_models.CommunicationServiceKeys]: + ) -> _models.CommunicationServiceKeys: """Regenerate Key. Regenerate CommunicationService access key. PrimaryKey and SecondaryKey cannot be regenerated @@ -1836,74 +1663,76 @@ def begin_regenerate_key( :type resource_group_name: str :param communication_service_name: The name of the CommunicationService resource. Required. :type communication_service_name: str - :param parameters: Parameter that describes the Regenerate Key Operation. Is either a model - type or a IO type. Required. + :param parameters: Parameter that describes the Regenerate Key Operation. Is either a + RegenerateKeyParameters type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.RegenerateKeyParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - :return: An instance of LROPoller that returns either CommunicationServiceKeys or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.communication.models.CommunicationServiceKeys] + :return: CommunicationServiceKeys or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.CommunicationServiceKeys :raises ~azure.core.exceptions.HttpResponseError: """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.CommunicationServiceKeys] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._regenerate_key_initial( - resource_group_name=resource_group_name, - communication_service_name=communication_service_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationServiceKeys", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) - return deserialized - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters else: - polling_method = polling - if cont_token: - return LROPoller.from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore + _json = self._serialize.body(parameters, "RegenerateKeyParameters") + + request = build_regenerate_key_request( + resource_group_name=resource_group_name, + communication_service_name=communication_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.regenerate_key.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("CommunicationServiceKeys", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized - begin_regenerate_key.metadata = { + regenerate_key.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/communicationServices/{communicationServiceName}/regenerateKey" } diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_domains_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_domains_operations.py index 63c6dee59b3e..2e9a52207cd8 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_domains_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_domains_operations.py @@ -49,8 +49,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -60,7 +60,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -87,8 +87,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -99,7 +99,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -128,8 +128,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -139,7 +139,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -166,8 +166,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -178,7 +178,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -207,8 +207,8 @@ def build_list_by_email_service_resource_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -218,7 +218,7 @@ def build_list_by_email_service_resource_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -244,8 +244,8 @@ def build_initiate_verification_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -256,7 +256,7 @@ def build_initiate_verification_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/initiateVerification", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -285,8 +285,8 @@ def build_cancel_verification_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -297,7 +297,7 @@ def build_cancel_verification_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/cancelVerification", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -370,7 +370,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DomainResource] = kwargs.pop("cls", None) @@ -388,8 +388,9 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -429,7 +430,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -459,8 +460,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -595,8 +597,8 @@ def begin_create_or_update( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Parameters for the create or update operation. Is either a model type or a - IO type. Required. + :param parameters: Parameters for the create or update operation. Is either a DomainResource + type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.DomainResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -617,7 +619,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -681,7 +683,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -699,8 +701,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -751,7 +754,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -815,7 +818,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -845,8 +848,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -978,8 +982,8 @@ def begin_update( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Parameters for the update operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the update operation. Is either a + UpdateDomainRequestParameters type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.UpdateDomainRequestParameters or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1000,7 +1004,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1071,7 +1075,7 @@ def list_by_email_service_resource( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.DomainResourceList] = kwargs.pop("cls", None) @@ -1127,8 +1131,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1164,7 +1169,7 @@ def _initiate_verification_initial( # pylint: disable=inconsistent-return-state _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1194,8 +1199,9 @@ def _initiate_verification_initial( # pylint: disable=inconsistent-return-state request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1315,8 +1321,8 @@ def begin_initiate_verification( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Type of verification to be initiated. Is either a model type or a IO type. - Required. + :param parameters: Type of verification to be initiated. Is either a VerificationParameter type + or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.VerificationParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1336,7 +1342,7 @@ def begin_initiate_verification( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1403,7 +1409,7 @@ def _cancel_verification_initial( # pylint: disable=inconsistent-return-stateme _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -1433,8 +1439,9 @@ def _cancel_verification_initial( # pylint: disable=inconsistent-return-stateme request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1554,8 +1561,8 @@ def begin_cancel_verification( :type email_service_name: str :param domain_name: The name of the Domains resource. Required. :type domain_name: str - :param parameters: Type of verification to be canceled. Is either a model type or a IO type. - Required. + :param parameters: Type of verification to be canceled. Is either a VerificationParameter type + or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.VerificationParameter or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -1575,7 +1582,7 @@ def begin_cancel_verification( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_email_services_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_email_services_operations.py index 7e951cf608a3..f703d61074a8 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_email_services_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_email_services_operations.py @@ -49,8 +49,8 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -60,7 +60,7 @@ def build_get_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -86,8 +86,8 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -98,7 +98,7 @@ def build_create_or_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -126,8 +126,8 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -137,7 +137,7 @@ def build_delete_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -163,8 +163,8 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -175,7 +175,7 @@ def build_update_request( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -201,15 +201,15 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/emailServices") path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -227,8 +227,8 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -238,7 +238,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), "resourceGroupName": _SERIALIZER.url( "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 ), @@ -259,8 +259,8 @@ def build_list_verified_exchange_online_domains_request(subscription_id: str, ** _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -270,7 +270,7 @@ def build_list_verified_exchange_online_domains_request(subscription_id: str, ** "/subscriptions/{subscriptionId}/providers/Microsoft.Communication/listVerifiedExchangeOnlineDomains", ) # pylint: disable=line-too-long path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), } _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore @@ -330,7 +330,7 @@ def get(self, resource_group_name: str, email_service_name: str, **kwargs: Any) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EmailServiceResource] = kwargs.pop("cls", None) @@ -347,8 +347,9 @@ def get(self, resource_group_name: str, email_service_name: str, **kwargs: Any) request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -387,7 +388,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -416,8 +417,9 @@ def _create_or_update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -540,8 +542,8 @@ def begin_create_or_update( :type resource_group_name: str :param email_service_name: The name of the EmailService resource. Required. :type email_service_name: str - :param parameters: Parameters for the create or update operation. Is either a model type or a - IO type. Required. + :param parameters: Parameters for the create or update operation. Is either a + EmailServiceResource type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.EmailServiceResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -562,7 +564,7 @@ def begin_create_or_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -625,7 +627,7 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -642,8 +644,9 @@ def _delete_initial( # pylint: disable=inconsistent-return-statements request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -690,7 +693,7 @@ def begin_delete(self, resource_group_name: str, email_service_name: str, **kwar _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[None] = kwargs.pop("cls", None) @@ -752,7 +755,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -781,8 +784,9 @@ def _update_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -905,8 +909,8 @@ def begin_update( :type resource_group_name: str :param email_service_name: The name of the EmailService resource. Required. :type email_service_name: str - :param parameters: Parameters for the update operation. Is either a model type or a IO type. - Required. + :param parameters: Parameters for the update operation. Is either a EmailServiceResourceUpdate + type or a IO type. Required. :type parameters: ~azure.mgmt.communication.models.EmailServiceResourceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. @@ -927,7 +931,7 @@ def begin_update( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) @@ -991,7 +995,7 @@ def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.EmailServiceR _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EmailServiceResourceList] = kwargs.pop("cls", None) @@ -1045,8 +1049,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1083,7 +1088,7 @@ def list_by_resource_group( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.EmailServiceResourceList] = kwargs.pop("cls", None) @@ -1138,8 +1143,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -1178,7 +1184,7 @@ def list_verified_exchange_online_domains(self, **kwargs: Any) -> List[str]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[List[str]] = kwargs.pop("cls", None) @@ -1193,8 +1199,9 @@ def list_verified_exchange_online_domains(self, **kwargs: Any) -> List[str]: request = _convert_request(request) request.url = self._client.format_url(request.url) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py index f0f0a6eb94d8..f7b95e1b9124 100644 --- a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_operations.py @@ -45,8 +45,8 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( - "api_version", _params.pop("api-version", "2022-07-01-preview") + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") ) accept = _headers.pop("Accept", "application/json") @@ -95,7 +95,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: Literal["2022-07-01-preview"] = kwargs.pop( + api_version: Literal["2023-03-01-preview"] = kwargs.pop( "api_version", _params.pop("api-version", self._config.api_version) ) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) @@ -148,8 +148,9 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) + _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=False, **kwargs + request, stream=_stream, **kwargs ) response = pipeline_response.http_response diff --git a/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_sender_usernames_operations.py b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_sender_usernames_operations.py new file mode 100644 index 000000000000..0e160ffcd951 --- /dev/null +++ b/sdk/communication/azure-mgmt-communication/azure/mgmt/communication/operations/_sender_usernames_operations.py @@ -0,0 +1,658 @@ +# pylint: disable=too-many-lines +# 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. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request, _format_url_section + +if sys.version_info >= (3, 8): + from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports +else: + from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_list_by_domains_request( + resource_group_name: str, email_service_name: str, domain_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "emailServiceName": _SERIALIZER.url( + "email_service_name", email_service_name, "str", max_length=63, min_length=1, pattern=r"^[a-zA-Z0-9-]+$" + ), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str", max_length=253, min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "emailServiceName": _SERIALIZER.url( + "email_service_name", email_service_name, "str", max_length=63, min_length=1, pattern=r"^[a-zA-Z0-9-]+$" + ), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str", max_length=253, min_length=1), + "senderUsername": _SERIALIZER.url("sender_username", sender_username, "str", max_length=253, min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "emailServiceName": _SERIALIZER.url( + "email_service_name", email_service_name, "str", max_length=63, min_length=1, pattern=r"^[a-zA-Z0-9-]+$" + ), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str", max_length=253, min_length=1), + "senderUsername": _SERIALIZER.url("sender_username", sender_username, "str", max_length=253, min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_delete_request( + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", "2023-03-01-preview") + ) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "emailServiceName": _SERIALIZER.url( + "email_service_name", email_service_name, "str", max_length=63, min_length=1, pattern=r"^[a-zA-Z0-9-]+$" + ), + "domainName": _SERIALIZER.url("domain_name", domain_name, "str", max_length=253, min_length=1), + "senderUsername": _SERIALIZER.url("sender_username", sender_username, "str", max_length=253, min_length=1), + } + + _url: str = _format_url_section(_url, **path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +class SenderUsernamesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.communication.CommunicationServiceManagementClient`'s + :attr:`sender_usernames` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list_by_domains( + self, resource_group_name: str, email_service_name: str, domain_name: str, **kwargs: Any + ) -> Iterable["_models.SenderUsernameResource"]: + """ListBy_Domains. + + List all valid sender usernames for a domains resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SenderUsernameResource or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.communication.models.SenderUsernameResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SenderUsernameResourceCollection] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_domains_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_domains.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SenderUsernameResourceCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + list_by_domains.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames" + } + + @distributed_trace + def get( + self, resource_group_name: str, email_service_name: str, domain_name: str, sender_username: str, **kwargs: Any + ) -> _models.SenderUsernameResource: + """Get. + + Get a valid sender username for a domains resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[_models.SenderUsernameResource] = kwargs.pop("cls", None) + + request = build_get_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + sender_username=sender_username, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + 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.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SenderUsernameResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" + } + + @overload + def create_or_update( + self, + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + parameters: _models.SenderUsernameResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SenderUsernameResource: + """Create Or Update. + + Add a new SenderUsername resource under the parent Domains resource or update an existing + SenderUsername resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: ~azure.mgmt.communication.models.SenderUsernameResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + parameters: IO, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SenderUsernameResource: + """Create Or Update. + + Add a new SenderUsername resource under the parent Domains resource or update an existing + SenderUsername resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :param parameters: Parameters for the create or update operation. Required. + :type parameters: IO + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + email_service_name: str, + domain_name: str, + sender_username: str, + parameters: Union[_models.SenderUsernameResource, IO], + **kwargs: Any + ) -> _models.SenderUsernameResource: + """Create Or Update. + + Add a new SenderUsername resource under the parent Domains resource or update an existing + SenderUsername resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :param parameters: Parameters for the create or update operation. Is either a + SenderUsernameResource type or a IO type. Required. + :type parameters: ~azure.mgmt.communication.models.SenderUsernameResource or IO + :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. + Default value is None. + :paramtype content_type: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SenderUsernameResource or the result of cls(response) + :rtype: ~azure.mgmt.communication.models.SenderUsernameResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SenderUsernameResource] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(parameters, (IO, bytes)): + _content = parameters + else: + _json = self._serialize.body(parameters, "SenderUsernameResource") + + request = build_create_or_update_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + sender_username=sender_username, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + template_url=self.create_or_update.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize("SenderUsernameResource", pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize("SenderUsernameResource", pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + create_or_update.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" + } + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, email_service_name: str, domain_name: str, sender_username: str, **kwargs: Any + ) -> None: + """Delete. + + Operation to delete a SenderUsernames resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param email_service_name: The name of the EmailService resource. Required. + :type email_service_name: str + :param domain_name: The name of the Domains resource. Required. + :type domain_name: str + :param sender_username: The valid sender Username. Required. + :type sender_username: str + :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 + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: Literal["2023-03-01-preview"] = kwargs.pop( + "api_version", _params.pop("api-version", self._config.api_version) + ) + cls: ClsType[None] = kwargs.pop("cls", None) + + request = build_delete_request( + resource_group_name=resource_group_name, + email_service_name=email_service_name, + domain_name=domain_name, + sender_username=sender_username, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata["url"], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = { + "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Communication/emailServices/{emailServiceName}/domains/{domainName}/senderUsernames/{senderUsername}" + } diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/cancel_verification.py b/sdk/communication/azure-mgmt-communication/generated_samples/cancel_verification.py index e653870373f0..ac395bc0c5d7 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/cancel_verification.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/cancel_verification.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.domains.begin_cancel_verification( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/domains/cancelVerification.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/domains/cancelVerification.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_available.py b/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_available.py index 8fea4070e54d..a9bfa96b55d3 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_available.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_available.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.check_name_availability( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/checkNameAvailabilityAvailable.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/checkNameAvailabilityAvailable.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_unavailable.py b/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_unavailable.py index e911bd0e2c39..196d92f59dbf 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_unavailable.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/check_name_availability_unavailable.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.check_name_availability( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/checkNameAvailabilityUnavailable.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/checkNameAvailabilityUnavailable.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/create_or_update.py b/sdk/communication/azure-mgmt-communication/generated_samples/create_or_update.py index 3c0d7368c1f6..4795cc8449f0 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/create_or_update.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/create_or_update.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.begin_create_or_update( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/createOrUpdate.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/createOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/delete.py b/sdk/communication/azure-mgmt-communication/generated_samples/delete.py index e121966e1179..681a751ec6eb 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/delete.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/delete.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.begin_delete( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/delete.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/delete.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/get.py b/sdk/communication/azure-mgmt-communication/generated_samples/get.py index 2954e5337fc0..64e7cacf577b 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/get.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/get.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/get.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/get.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/get_verified_exchange_online_domains.py b/sdk/communication/azure-mgmt-communication/generated_samples/get_verified_exchange_online_domains.py index 8a4220e79434..0162dd575be9 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/get_verified_exchange_online_domains.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/get_verified_exchange_online_domains.py @@ -26,13 +26,13 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.email_services.list_verified_exchange_online_domains() print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/emailServices/getVerifiedExchangeOnlineDomains.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/emailServices/getVerifiedExchangeOnlineDomains.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/initiate_verification.py b/sdk/communication/azure-mgmt-communication/generated_samples/initiate_verification.py index 233e7351d58a..2178899c63b0 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/initiate_verification.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/initiate_verification.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.domains.begin_initiate_verification( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/domains/initiateVerification.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/domains/initiateVerification.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/link_notification_hub.py b/sdk/communication/azure-mgmt-communication/generated_samples/link_notification_hub.py index ddbb54172e54..84e2c98fa0e1 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/link_notification_hub.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/link_notification_hub.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.link_notification_hub( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/linkNotificationHub.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/linkNotificationHub.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/list_by_domain.py b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_domain.py new file mode 100644 index 000000000000..ea103826fe39 --- /dev/null +++ b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_domain.py @@ -0,0 +1,43 @@ +# 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 azure.identity import DefaultAzureCredential +from azure.mgmt.communication import CommunicationServiceManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-communication +# USAGE + python list_by_domain.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = CommunicationServiceManagementClient( + credential=DefaultAzureCredential(), + subscription_id="11112222-3333-4444-5555-666677778888", + ) + + response = client.sender_usernames.list_by_domains( + resource_group_name="contosoResourceGroup", + email_service_name="contosoEmailService", + domain_name="contoso.com", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/senderUsernames/listByDomain.json +if __name__ == "__main__": + main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/list_by_email_service.py b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_email_service.py index 9957aab94a54..b4570dff4e05 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/list_by_email_service.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_email_service.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.domains.list_by_email_service_resource( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/domains/listByEmailService.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/domains/listByEmailService.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/list_by_resource_group.py b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_resource_group.py index 8c8da6def661..983118bd3c2a 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/list_by_resource_group.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_resource_group.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.list_by_resource_group( @@ -36,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/listByResourceGroup.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/listByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/list_by_subscription.py b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_subscription.py index 16c7410a5133..6734d6264976 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/list_by_subscription.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/list_by_subscription.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.list_by_subscription() @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/listBySubscription.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/listBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/list_keys.py b/sdk/communication/azure-mgmt-communication/generated_samples/list_keys.py index 43fd94f03c0f..2ab64110709d 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/list_keys.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/list_keys.py @@ -26,7 +26,7 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) response = client.communication_services.list_keys( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/listKeys.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/listKeys.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/operations_list.py b/sdk/communication/azure-mgmt-communication/generated_samples/operations_list.py index b490dc6f25a0..4581277a985e 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/operations_list.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/operations_list.py @@ -34,6 +34,6 @@ def main(): print(item) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/operationsList.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/operationsList.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/regenerate_key.py b/sdk/communication/azure-mgmt-communication/generated_samples/regenerate_key.py index 2b29b786f2ef..eaca4da94747 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/regenerate_key.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/regenerate_key.py @@ -26,17 +26,17 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) - response = client.communication_services.begin_regenerate_key( + response = client.communication_services.regenerate_key( resource_group_name="MyResourceGroup", communication_service_name="MyCommunicationResource", parameters={"keyType": "Primary"}, - ).result() + ) print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/regenerateKey.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/regenerateKey.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/generated_samples/update.py b/sdk/communication/azure-mgmt-communication/generated_samples/update.py index 7914ed843abc..ca70355a1153 100644 --- a/sdk/communication/azure-mgmt-communication/generated_samples/update.py +++ b/sdk/communication/azure-mgmt-communication/generated_samples/update.py @@ -26,17 +26,17 @@ def main(): client = CommunicationServiceManagementClient( credential=DefaultAzureCredential(), - subscription_id="12345", + subscription_id="11112222-3333-4444-5555-666677778888", ) - response = client.communication_services.begin_update( + response = client.communication_services.update( resource_group_name="MyResourceGroup", communication_service_name="MyCommunicationResource", parameters={"tags": {"newTag": "newVal"}}, - ).result() + ) print(response) -# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2022-07-01-preview/examples/communicationServices/update.json +# x-ms-original-file: specification/communication/resource-manager/Microsoft.Communication/preview/2023-03-01-preview/examples/communicationServices/update.json if __name__ == "__main__": main() diff --git a/sdk/communication/azure-mgmt-communication/setup.py b/sdk/communication/azure-mgmt-communication/setup.py index c34d8c5c47b3..952cdbedccff 100644 --- a/sdk/communication/azure-mgmt-communication/setup.py +++ b/sdk/communication/azure-mgmt-communication/setup.py @@ -70,7 +70,7 @@ 'pytyped': ['py.typed'], }, install_requires=[ - "msrest>=0.7.1", + "isodate<1.0.0,>=0.6.1", "azure-common~=1.1", "azure-mgmt-core>=1.3.2,<2.0.0", "typing-extensions>=4.3.0; python_version<'3.8.0'",