diff --git a/sdk/support/azure-mgmt-support/CHANGELOG.md b/sdk/support/azure-mgmt-support/CHANGELOG.md index c830866fb13e..560742cc1d3b 100644 --- a/sdk/support/azure-mgmt-support/CHANGELOG.md +++ b/sdk/support/azure-mgmt-support/CHANGELOG.md @@ -1,5 +1,45 @@ # Release History +## 8.0.0b1 (2025-04-22) + +### Features Added + + - Model `MicrosoftSupport` added property `service_classifications_no_subscription` + - Model `MicrosoftSupport` added property `service_classifications` + - Model `MicrosoftSupport` added property `problem_classifications_no_subscription` + - Model `MicrosoftSupport` added property `look_up_resource_id` + - Model `ProblemClassification` added property `metadata` + - Model `ProblemClassification` added property `parent_problem_classification` + - Model `Service` added property `metadata` + - Added model `ClassificationService` + - Added model `LookUpResourceIdRequest` + - Added model `LookUpResourceIdResponse` + - Added model `ProblemClassificationsClassificationInput` + - Added model `ProblemClassificationsClassificationOutput` + - Added model `ProblemClassificationsClassificationResult` + - Added model `ServiceClassificationAnswer` + - Added model `ServiceClassificationOutput` + - Added model `ServiceClassificationRequest` + - Model `ProblemClassificationsOperations` added method `classify_problems` + - Added model `LookUpResourceIdOperations` + - Added model `ProblemClassificationsNoSubscriptionOperations` + - Added model `ServiceClassificationsNoSubscriptionOperations` + - Added model `ServiceClassificationsOperations` + - Method `ProblemClassificationsOperations.classify_problems` has a new overload `def classify_problems(self: None, problem_service_name: str, problem_classifications_classification_input: ProblemClassificationsClassificationInput, content_type: str)` + - Method `ProblemClassificationsOperations.classify_problems` has a new overload `def classify_problems(self: None, problem_service_name: str, problem_classifications_classification_input: IO[bytes], content_type: str)` + - Method `LookUpResourceIdOperations.post` has a new overload `def post(self: None, look_up_resource_id_request: LookUpResourceIdRequest, content_type: str)` + - Method `LookUpResourceIdOperations.post` has a new overload `def post(self: None, look_up_resource_id_request: IO[bytes], content_type: str)` + - Method `ProblemClassificationsNoSubscriptionOperations.classify_problems` has a new overload `def classify_problems(self: None, problem_service_name: str, problem_classifications_classification_input: ProblemClassificationsClassificationInput, content_type: str)` + - Method `ProblemClassificationsNoSubscriptionOperations.classify_problems` has a new overload `def classify_problems(self: None, problem_service_name: str, problem_classifications_classification_input: IO[bytes], content_type: str)` + - Method `ServiceClassificationsNoSubscriptionOperations.classify_services` has a new overload `def classify_services(self: None, service_classification_request: ServiceClassificationRequest, content_type: str)` + - Method `ServiceClassificationsNoSubscriptionOperations.classify_services` has a new overload `def classify_services(self: None, service_classification_request: IO[bytes], content_type: str)` + - Method `ServiceClassificationsOperations.classify_services` has a new overload `def classify_services(self: None, service_classification_request: ServiceClassificationRequest, content_type: str)` + - Method `ServiceClassificationsOperations.classify_services` has a new overload `def classify_services(self: None, service_classification_request: IO[bytes], content_type: str)` + +### Breaking Changes + + - Method `MessageProperties.__init__` removed default value `None` from its parameter `body` + ## 7.0.0 (2024-04-22) ### Features Added diff --git a/sdk/support/azure-mgmt-support/README.md b/sdk/support/azure-mgmt-support/README.md index bf0a6ac456dc..ac99d932e22d 100644 --- a/sdk/support/azure-mgmt-support/README.md +++ b/sdk/support/azure-mgmt-support/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Support Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.9+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ 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. +By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/support/azure-mgmt-support/_meta.json b/sdk/support/azure-mgmt-support/_meta.json index ebfe2dc6b38c..466da5226120 100644 --- a/sdk/support/azure-mgmt-support/_meta.json +++ b/sdk/support/azure-mgmt-support/_meta.json @@ -1,11 +1,11 @@ { - "commit": "665e7c3b6f26b148b3c05e55602621bc293cc0a4", + "commit": "ff7eff59e0ab6446fb76cb28ccfc7b0cae400dbb", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", + "autorest": "3.10.2", "use": [ - "@autorest/python@6.13.7", + "@autorest/python@6.33.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/support/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.13.7 --use=@autorest/modelerfour@4.27.0 --version=3.9.7 --version-tolerant=False", + "autorest_command": "autorest specification/support/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.33.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/support/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py index da1ba13904e9..a38aae772458 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py @@ -5,15 +5,21 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._microsoft_support import MicrosoftSupport +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._microsoft_support import MicrosoftSupport # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -21,6 +27,6 @@ __all__ = [ "MicrosoftSupport", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py index 9f873d76f422..e824fc902bf3 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py @@ -14,11 +14,10 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for MicrosoftSupport. Note that all parameters used to create this instance are saved as instance @@ -28,13 +27,13 @@ class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attrib :type credential: ~azure.core.credentials.TokenCredential :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 "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2023-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py index 5a49fb8ca3bf..cc2b7da87598 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py @@ -7,12 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING, cast +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from . import models as _models from ._configuration import MicrosoftSupportConfiguration @@ -26,25 +29,39 @@ FileWorkspacesOperations, FilesNoSubscriptionOperations, FilesOperations, + LookUpResourceIdOperations, Operations, + ProblemClassificationsNoSubscriptionOperations, ProblemClassificationsOperations, + ServiceClassificationsNoSubscriptionOperations, + ServiceClassificationsOperations, ServicesOperations, SupportTicketsNoSubscriptionOperations, SupportTicketsOperations, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class MicrosoftSupport: # pylint: disable=too-many-instance-attributes """Microsoft Azure Support Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.support.operations.Operations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.support.operations.ServicesOperations + :ivar service_classifications_no_subscription: ServiceClassificationsNoSubscriptionOperations + operations + :vartype service_classifications_no_subscription: + azure.mgmt.support.operations.ServiceClassificationsNoSubscriptionOperations + :ivar service_classifications: ServiceClassificationsOperations operations + :vartype service_classifications: + azure.mgmt.support.operations.ServiceClassificationsOperations + :ivar problem_classifications_no_subscription: ProblemClassificationsNoSubscriptionOperations + operations + :vartype problem_classifications_no_subscription: + azure.mgmt.support.operations.ProblemClassificationsNoSubscriptionOperations :ivar problem_classifications: ProblemClassificationsOperations operations :vartype problem_classifications: azure.mgmt.support.operations.ProblemClassificationsOperations @@ -72,27 +89,33 @@ class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,to :vartype files: azure.mgmt.support.operations.FilesOperations :ivar files_no_subscription: FilesNoSubscriptionOperations operations :vartype files_no_subscription: azure.mgmt.support.operations.FilesNoSubscriptionOperations + :ivar look_up_resource_id: LookUpResourceIdOperations operations + :vartype look_up_resource_id: azure.mgmt.support.operations.LookUpResourceIdOperations :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. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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 Retry-After header is present. """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = MicrosoftSupportConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = MicrosoftSupportConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -111,7 +134,7 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -119,6 +142,15 @@ def __init__( self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_classifications_no_subscription = ServiceClassificationsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.service_classifications = ServiceClassificationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.problem_classifications_no_subscription = ProblemClassificationsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.problem_classifications = ProblemClassificationsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -144,6 +176,9 @@ def __init__( self.files_no_subscription = FilesNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) + self.look_up_resource_id = LookUpResourceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. @@ -170,7 +205,7 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: def close(self) -> None: self._client.close() - def __enter__(self) -> "MicrosoftSupport": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py index 2f781d740827..f5187701d7be 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -48,11 +30,8 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, - Mapping, ) try: @@ -62,13 +41,13 @@ import xml.etree.ElementTree as ET import isodate # type: ignore +from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +70,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +93,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +125,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +136,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -177,80 +165,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + for k in kwargs: # pylint: disable=consider-using-dict-items 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__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +244,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +280,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,7 +304,9 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, @@ -378,12 +340,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,30 +358,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -424,9 +390,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +414,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +471,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,7 +512,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -558,13 +532,16 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): self.key_transformer = full_restapi_key_transformer self.client_side_validation = True - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,12 +567,14 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": @@ -631,7 +610,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -662,17 +642,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +681,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,11 +690,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -726,21 +708,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +738,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +760,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,7 +784,7 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class @@ -819,11 +800,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +819,26 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + return eval(data_type)(data) # nosec # pylint: disable=eval-used @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +852,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +862,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +923,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +948,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -977,6 +956,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +981,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1012,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1074,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1089,32 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1127,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1159,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,11 +1174,11 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data @@ -1209,7 +1199,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1222,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1281,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1333,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1352,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,9 +1364,9 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - 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}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1399,27 +1402,29 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1443,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1479,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1503,6 +1507,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1520,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1535,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1558,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1587,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1624,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1625,7 +1647,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1645,14 +1671,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1695,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,13 +1706,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1718,11 +1746,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1730,8 +1757,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1741,24 +1769,23 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + return eval(data_type)(attr) # nosec # pylint: disable=eval-used @staticmethod def deserialize_unicode(data): @@ -1766,6 +1793,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1807,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1819,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1830,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,8 +1848,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1832,8 +1861,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1847,8 +1877,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,8 +1894,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1875,8 +1907,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1885,16 +1918,16 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1908,8 +1941,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1922,31 +1956,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1974,8 +2009,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,8 +2017,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1994,5 +2029,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_vendor.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_vendor.py deleted file mode 100644 index 0dafe0e287ff..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_vendor.py +++ /dev/null @@ -1,16 +0,0 @@ -# -------------------------------------------------------------------------- -# 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.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py index 364f3c906cf9..0d5779dc14de 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "8.0.0b1" diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py index 84840d00d4b1..8bc67272046b 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py @@ -5,12 +5,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._microsoft_support import MicrosoftSupport +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._microsoft_support import MicrosoftSupport # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk @@ -18,6 +24,6 @@ __all__ = [ "MicrosoftSupport", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_configuration.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_configuration.py index 7e2315ec2c70..9d686d266f9d 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_configuration.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_configuration.py @@ -14,11 +14,10 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long +class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes """Configuration for MicrosoftSupport. Note that all parameters used to create this instance are saved as instance @@ -28,13 +27,13 @@ class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attrib :type credential: ~azure.core.credentials_async.AsyncTokenCredential :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 "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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: - api_version: str = kwargs.pop("api_version", "2024-04-01") + api_version: str = kwargs.pop("api_version", "2023-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_microsoft_support.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_microsoft_support.py index 2c4642859e08..d0f8e7dff663 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_microsoft_support.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_microsoft_support.py @@ -7,12 +7,15 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast +from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints from .. import models as _models from .._serialization import Deserializer, Serializer @@ -26,25 +29,39 @@ FileWorkspacesOperations, FilesNoSubscriptionOperations, FilesOperations, + LookUpResourceIdOperations, Operations, + ProblemClassificationsNoSubscriptionOperations, ProblemClassificationsOperations, + ServiceClassificationsNoSubscriptionOperations, + ServiceClassificationsOperations, ServicesOperations, SupportTicketsNoSubscriptionOperations, SupportTicketsOperations, ) if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class MicrosoftSupport: # pylint: disable=too-many-instance-attributes """Microsoft Azure Support Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.support.aio.operations.Operations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.support.aio.operations.ServicesOperations + :ivar service_classifications_no_subscription: ServiceClassificationsNoSubscriptionOperations + operations + :vartype service_classifications_no_subscription: + azure.mgmt.support.aio.operations.ServiceClassificationsNoSubscriptionOperations + :ivar service_classifications: ServiceClassificationsOperations operations + :vartype service_classifications: + azure.mgmt.support.aio.operations.ServiceClassificationsOperations + :ivar problem_classifications_no_subscription: ProblemClassificationsNoSubscriptionOperations + operations + :vartype problem_classifications_no_subscription: + azure.mgmt.support.aio.operations.ProblemClassificationsNoSubscriptionOperations :ivar problem_classifications: ProblemClassificationsOperations operations :vartype problem_classifications: azure.mgmt.support.aio.operations.ProblemClassificationsOperations @@ -72,27 +89,33 @@ class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,to :vartype files: azure.mgmt.support.aio.operations.FilesOperations :ivar files_no_subscription: FilesNoSubscriptionOperations operations :vartype files_no_subscription: azure.mgmt.support.aio.operations.FilesNoSubscriptionOperations + :ivar look_up_resource_id: LookUpResourceIdOperations operations + :vartype look_up_resource_id: azure.mgmt.support.aio.operations.LookUpResourceIdOperations :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. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service URL. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2023-06-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 Retry-After header is present. """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: - self._config = MicrosoftSupportConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = MicrosoftSupportConfiguration( + credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -111,7 +134,9 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, base_url), policies=_policies, **kwargs + ) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -119,6 +144,15 @@ def __init__( self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + self.service_classifications_no_subscription = ServiceClassificationsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.service_classifications = ServiceClassificationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.problem_classifications_no_subscription = ProblemClassificationsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.problem_classifications = ProblemClassificationsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -144,6 +178,9 @@ def __init__( self.files_no_subscription = FilesNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) + self.look_up_resource_id = LookUpResourceIdOperations( + self._client, self._config, self._serialize, self._deserialize + ) def _send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any @@ -172,7 +209,7 @@ def _send_request( async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MicrosoftSupport": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/__init__.py index 7700443bd45e..88513a436ac0 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/__init__.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,28 +6,41 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._services_operations import ServicesOperations -from ._problem_classifications_operations import ProblemClassificationsOperations -from ._support_tickets_operations import SupportTicketsOperations -from ._support_tickets_no_subscription_operations import SupportTicketsNoSubscriptionOperations -from ._communications_operations import CommunicationsOperations -from ._communications_no_subscription_operations import CommunicationsNoSubscriptionOperations -from ._chat_transcripts_operations import ChatTranscriptsOperations -from ._chat_transcripts_no_subscription_operations import ChatTranscriptsNoSubscriptionOperations -from ._file_workspaces_operations import FileWorkspacesOperations -from ._file_workspaces_no_subscription_operations import FileWorkspacesNoSubscriptionOperations -from ._files_operations import FilesOperations -from ._files_no_subscription_operations import FilesNoSubscriptionOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._services_operations import ServicesOperations # type: ignore +from ._service_classifications_no_subscription_operations import ServiceClassificationsNoSubscriptionOperations # type: ignore +from ._service_classifications_operations import ServiceClassificationsOperations # type: ignore +from ._problem_classifications_no_subscription_operations import ProblemClassificationsNoSubscriptionOperations # type: ignore +from ._problem_classifications_operations import ProblemClassificationsOperations # type: ignore +from ._support_tickets_operations import SupportTicketsOperations # type: ignore +from ._support_tickets_no_subscription_operations import SupportTicketsNoSubscriptionOperations # type: ignore +from ._communications_operations import CommunicationsOperations # type: ignore +from ._communications_no_subscription_operations import CommunicationsNoSubscriptionOperations # type: ignore +from ._chat_transcripts_operations import ChatTranscriptsOperations # type: ignore +from ._chat_transcripts_no_subscription_operations import ChatTranscriptsNoSubscriptionOperations # type: ignore +from ._file_workspaces_operations import FileWorkspacesOperations # type: ignore +from ._file_workspaces_no_subscription_operations import FileWorkspacesNoSubscriptionOperations # type: ignore +from ._files_operations import FilesOperations # type: ignore +from ._files_no_subscription_operations import FilesNoSubscriptionOperations # type: ignore +from ._look_up_resource_id_operations import LookUpResourceIdOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "ServicesOperations", + "ServiceClassificationsNoSubscriptionOperations", + "ServiceClassificationsOperations", + "ProblemClassificationsNoSubscriptionOperations", "ProblemClassificationsOperations", "SupportTicketsOperations", "SupportTicketsNoSubscriptionOperations", @@ -38,6 +52,7 @@ "FileWorkspacesNoSubscriptionOperations", "FilesOperations", "FilesNoSubscriptionOperations", + "LookUpResourceIdOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_no_subscription_operations.py index 755d72d51c69..6d43394ea4f4 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,16 +20,16 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._serialization import Deserializer, Serializer from ...operations._chat_transcripts_no_subscription_operations import build_get_request, build_list_request +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,10 +49,10 @@ class ChatTranscriptsNoSubscriptionOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_models.ChatTranscriptDetails"]: @@ -71,7 +72,7 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -88,7 +89,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -104,7 +104,6 @@ def prepare_request(next_link=None): _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 @@ -148,7 +147,7 @@ async def get( :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -169,7 +168,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -184,7 +182,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) + deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_operations.py index 3edc30641c9b..090ec99aefe4 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,16 +20,16 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._serialization import Deserializer, Serializer from ...operations._chat_transcripts_operations import build_get_request, build_list_request +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,10 +49,10 @@ class ChatTranscriptsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_models.ChatTranscriptDetails"]: @@ -71,7 +72,7 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +105,6 @@ def prepare_request(next_link=None): _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 @@ -149,7 +148,7 @@ async def get( :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +170,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +184,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) + deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_no_subscription_operations.py index 4cf8c6427c3b..27d6c49ec08f 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -30,13 +32,14 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._serialization import Deserializer, Serializer from ...operations._communications_no_subscription_operations import ( build_check_name_availability_request, build_create_request, build_get_request, build_list_request, ) +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,10 +59,10 @@ class CommunicationsNoSubscriptionOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def check_name_availability( @@ -129,7 +132,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -161,7 +164,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -176,7 +178,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -190,10 +192,10 @@ def list( """Lists all communications (attachments not included) for a support ticket. :code:`
`
You can also filter support ticket communications by *CreatedDate* or *CommunicationType* using the $filter parameter. The only type of communication supported today is *Web*. Output will be - a paged result with *nextLink*\ , using which you can retrieve the next set of Communication - results. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. + a paged result with *nextLink*\\ , using which you can retrieve the next set of Communication + results. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after + ticket creation. If a ticket was created more than 18 months ago, a request for data might + cause an error. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -218,7 +220,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -237,7 +239,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -253,7 +254,6 @@ def prepare_request(next_link=None): _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 @@ -297,7 +297,7 @@ async def get( :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -318,7 +318,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -333,7 +332,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -346,8 +345,8 @@ async def _create_initial( communication_name: str, create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -360,7 +359,7 @@ async def _create_initial( api_version: str = 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -380,10 +379,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -391,18 +390,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -506,10 +507,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_operations.py index 3e7cb58c22f6..8ccc08b6c4b1 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -30,13 +32,14 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._serialization import Deserializer, Serializer from ...operations._communications_operations import ( build_check_name_availability_request, build_create_request, build_get_request, build_list_request, ) +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -56,10 +59,10 @@ class CommunicationsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def check_name_availability( @@ -129,7 +132,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -162,7 +165,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -177,7 +179,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -191,10 +193,10 @@ def list( """Lists all communications (attachments not included) for a support ticket. :code:`
`
You can also filter support ticket communications by *CreatedDate* or *CommunicationType* using the $filter parameter. The only type of communication supported today is *Web*. Output will be - a paged result with *nextLink*\ , using which you can retrieve the next set of Communication - results. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. + a paged result with *nextLink*\\ , using which you can retrieve the next set of Communication + results. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after + ticket creation. If a ticket was created more than 18 months ago, a request for data might + cause an error. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -219,7 +221,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -239,7 +241,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -255,7 +256,6 @@ def prepare_request(next_link=None): _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 @@ -299,7 +299,7 @@ async def get( :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -321,7 +321,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -336,7 +335,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -349,8 +348,8 @@ async def _create_initial( communication_name: str, create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -363,7 +362,7 @@ async def _create_initial( api_version: str = 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -384,10 +383,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -395,13 +394,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -506,10 +507,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_no_subscription_operations.py index 783df934f0c6..9c77a48cd6dd 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -17,15 +18,15 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 ..._serialization import Deserializer, Serializer from ...operations._file_workspaces_no_subscription_operations import build_create_request, build_get_request +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,10 +46,10 @@ class FileWorkspacesNoSubscriptionOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -60,7 +61,7 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -80,7 +81,6 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -95,7 +95,7 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -112,7 +112,7 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -132,7 +132,6 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -147,7 +146,7 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_operations.py index 4294736acf51..8fdcf65cc71e 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import AsyncPipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -17,15 +18,15 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest 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 ..._serialization import Deserializer, Serializer from ...operations._file_workspaces_operations import build_create_request, build_get_request +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -45,10 +46,10 @@ class FileWorkspacesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace_async async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -60,7 +61,7 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -81,7 +82,6 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -96,7 +96,7 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -113,7 +113,7 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,7 +134,6 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -149,7 +148,7 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_no_subscription_operations.py index 316fbe98d52f..093fc5dbd669 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,21 +21,21 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._serialization import Deserializer, Serializer from ...operations._files_no_subscription_operations import ( build_create_request, build_get_request, build_list_request, build_upload_request, ) +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,10 +55,10 @@ class FilesNoSubscriptionOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_models.FileDetails"]: @@ -75,7 +76,7 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FilesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -92,7 +93,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -108,7 +108,6 @@ def prepare_request(next_link=None): _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 @@ -150,7 +149,7 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -171,7 +170,6 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -186,7 +184,7 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -266,7 +264,7 @@ async def create( :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +297,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -314,7 +311,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -322,7 +319,7 @@ async def create( return deserialized # type: ignore @overload - async def upload( # pylint: disable=inconsistent-return-statements + async def upload( self, file_workspace_name: str, file_name: str, @@ -348,7 +345,7 @@ async def upload( # pylint: disable=inconsistent-return-statements """ @overload - async def upload( # pylint: disable=inconsistent-return-statements + async def upload( self, file_workspace_name: str, file_name: str, @@ -374,7 +371,7 @@ async def upload( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def upload( # pylint: disable=inconsistent-return-statements + async def upload( self, file_workspace_name: str, file_name: str, upload_file: Union[_models.UploadFile, IO[bytes]], **kwargs: Any ) -> None: """This API allows you to upload content to a file. @@ -390,7 +387,7 @@ async def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -423,7 +420,6 @@ async def upload( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_operations.py index a074dec56bdb..ab67fd9ea3c8 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -20,21 +21,21 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._serialization import Deserializer, Serializer from ...operations._files_operations import ( build_create_request, build_get_request, build_list_request, build_upload_request, ) +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -54,10 +55,10 @@ class FilesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_models.FileDetails"]: @@ -75,7 +76,7 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FilesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -93,7 +94,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -109,7 +109,6 @@ def prepare_request(next_link=None): _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 @@ -151,7 +150,7 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -173,7 +172,6 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -188,7 +186,7 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -268,7 +266,7 @@ async def create( :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -302,7 +300,6 @@ async def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -317,7 +314,7 @@ async def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -325,7 +322,7 @@ async def create( return deserialized # type: ignore @overload - async def upload( # pylint: disable=inconsistent-return-statements + async def upload( self, file_workspace_name: str, file_name: str, @@ -351,7 +348,7 @@ async def upload( # pylint: disable=inconsistent-return-statements """ @overload - async def upload( # pylint: disable=inconsistent-return-statements + async def upload( self, file_workspace_name: str, file_name: str, @@ -377,7 +374,7 @@ async def upload( # pylint: disable=inconsistent-return-statements """ @distributed_trace_async - async def upload( # pylint: disable=inconsistent-return-statements + async def upload( self, file_workspace_name: str, file_name: str, upload_file: Union[_models.UploadFile, IO[bytes]], **kwargs: Any ) -> None: """This API allows you to upload content to a file. @@ -393,7 +390,7 @@ async def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -427,7 +424,6 @@ async def upload( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_look_up_resource_id_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_look_up_resource_id_operations.py new file mode 100644 index 000000000000..e4fc1afad485 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_look_up_resource_id_operations.py @@ -0,0 +1,161 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ..._serialization import Deserializer, Serializer +from ...operations._look_up_resource_id_operations import build_post_request +from .._configuration import MicrosoftSupportConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class LookUpResourceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s + :attr:`look_up_resource_id` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def post( + self, + look_up_resource_id_request: _models.LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """This operation fetches ARM resource id of support resource type. + + This operation fetches ARM resource id of support resource type. + + :param look_up_resource_id_request: Look up resource id request body. Required. + :type look_up_resource_id_request: ~azure.mgmt.support.models.LookUpResourceIdRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LookUpResourceIdResponse or the result of cls(response) + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( + self, look_up_resource_id_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """This operation fetches ARM resource id of support resource type. + + This operation fetches ARM resource id of support resource type. + + :param look_up_resource_id_request: Look up resource id request body. Required. + :type look_up_resource_id_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LookUpResourceIdResponse or the result of cls(response) + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( + self, look_up_resource_id_request: Union[_models.LookUpResourceIdRequest, IO[bytes]], **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """This operation fetches ARM resource id of support resource type. + + This operation fetches ARM resource id of support resource type. + + :param look_up_resource_id_request: Look up resource id request body. Is either a + LookUpResourceIdRequest type or a IO[bytes] type. Required. + :type look_up_resource_id_request: ~azure.mgmt.support.models.LookUpResourceIdRequest or + IO[bytes] + :return: LookUpResourceIdResponse or the result of cls(response) + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.LookUpResourceIdResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(look_up_resource_id_request, (IOBase, bytes)): + _content = look_up_resource_id_request + else: + _json = self._serialize.body(look_up_resource_id_request, "LookUpResourceIdRequest") + + _request = build_post_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("LookUpResourceIdResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_operations.py index f35fe0803df8..2f7e767cc3bd 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,15 +20,15 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._vendor import _convert_request +from ..._serialization import Deserializer, Serializer from ...operations._operations import build_list_request +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -47,10 +48,10 @@ class Operations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -66,7 +67,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -82,7 +83,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -98,7 +98,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_no_subscription_operations.py new file mode 100644 index 000000000000..df0b782bd81e --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_no_subscription_operations.py @@ -0,0 +1,179 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ..._serialization import Deserializer, Serializer +from ...operations._problem_classifications_no_subscription_operations import build_classify_problems_request +from .._configuration import MicrosoftSupportConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ProblemClassificationsNoSubscriptionOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s + :attr:`problem_classifications_no_subscription` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, IO[bytes] + ], + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Is either a + ProblemClassificationsClassificationInput type or a IO[bytes] type. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ProblemClassificationsClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _json = self._serialize.body( + problem_classifications_classification_input, "ProblemClassificationsClassificationInput" + ) + + _request = build_classify_problems_request( + problem_service_name=problem_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ProblemClassificationsClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_operations.py index b950a8ec3f27..fbbefba76fd5 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,16 +21,20 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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._problem_classifications_operations import build_get_request, build_list_request +from ..._serialization import Deserializer, Serializer +from ...operations._problem_classifications_operations import ( + build_classify_problems_request, + build_get_request, + build_list_request, +) +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,10 +54,137 @@ class ProblemClassificationsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, IO[bytes] + ], + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Is either a + ProblemClassificationsClassificationInput type or a IO[bytes] type. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ProblemClassificationsClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _json = self._serialize.body( + problem_classifications_classification_input, "ProblemClassificationsClassificationInput" + ) + + _request = build_classify_problems_request( + problem_service_name=problem_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ProblemClassificationsClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def list(self, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ProblemClassification"]: @@ -74,7 +207,7 @@ def list(self, service_name: str, **kwargs: Any) -> AsyncIterable["_models.Probl api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProblemClassificationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -91,7 +224,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -107,7 +239,6 @@ def prepare_request(next_link=None): _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 @@ -143,7 +274,8 @@ async def get( ) -> _models.ProblemClassification: """Get problem classification details for a specific Azure service. - :param service_name: Name of the Azure service available for support. Required. + :param service_name: Name of the Azure service for which the problem classifications need to be + retrieved. Required. :type service_name: str :param problem_classification_name: Name of problem classification. Required. :type problem_classification_name: str @@ -151,7 +283,7 @@ async def get( :rtype: ~azure.mgmt.support.models.ProblemClassification :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -172,7 +304,6 @@ async def get( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -187,7 +318,7 @@ async def get( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProblemClassification", pipeline_response) + deserialized = self._deserialize("ProblemClassification", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_no_subscription_operations.py new file mode 100644 index 000000000000..7ec7343e558b --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_no_subscription_operations.py @@ -0,0 +1,155 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ..._serialization import Deserializer, Serializer +from ...operations._service_classifications_no_subscription_operations import build_classify_services_request +from .._configuration import MicrosoftSupportConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceClassificationsNoSubscriptionOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s + :attr:`service_classifications_no_subscription` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def classify_services( + self, service_classification_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def classify_services( + self, service_classification_request: Union[_models.ServiceClassificationRequest, IO[bytes]], **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Is either a ServiceClassificationRequest + type or a IO[bytes] type. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + or IO[bytes] + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ServiceClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _json = self._serialize.body(service_classification_request, "ServiceClassificationRequest") + + _request = build_classify_services_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ServiceClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_operations.py new file mode 100644 index 000000000000..2a4fcb8aef3b --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_operations.py @@ -0,0 +1,156 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import AsyncPipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +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 ..._serialization import Deserializer, Serializer +from ...operations._service_classifications_operations import build_classify_services_request +from .._configuration import MicrosoftSupportConfiguration + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ServiceClassificationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s + :attr:`service_classifications` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def classify_services( + self, service_classification_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def classify_services( + self, service_classification_request: Union[_models.ServiceClassificationRequest, IO[bytes]], **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Is either a ServiceClassificationRequest + type or a IO[bytes] type. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + or IO[bytes] + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ServiceClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _json = self._serialize.body(service_classification_request, "ServiceClassificationRequest") + + _request = build_classify_services_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ServiceClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_services_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_services_operations.py index 9a2d4cbbc3d6..1371fbf5a873 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_services_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -19,16 +20,16 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 ..._serialization import Deserializer, Serializer from ...operations._services_operations import build_get_request, build_list_request +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -48,10 +49,10 @@ class ServicesOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Service"]: @@ -73,7 +74,7 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Service"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServicesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -89,7 +90,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -105,7 +105,6 @@ def prepare_request(next_link=None): _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 @@ -139,13 +138,14 @@ async def get_next(next_link=None): async def get(self, service_name: str, **kwargs: Any) -> _models.Service: """Gets a specific Azure service for support ticket creation. - :param service_name: Name of the Azure service. Required. + :param service_name: Name of the Azure service for which the problem classifications need to be + retrieved. Required. :type service_name: str :return: Service or the result of cls(response) :rtype: ~azure.mgmt.support.models.Service :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -165,7 +165,6 @@ async def get(self, service_name: str, **kwargs: Any) -> _models.Service: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -180,7 +179,7 @@ async def get(self, service_name: str, **kwargs: Any) -> _models.Service: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Service", pipeline_response) + deserialized = self._deserialize("Service", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_no_subscription_operations.py index 62a9209d7068..f1f43eb2bdec 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -30,7 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._serialization import Deserializer, Serializer from ...operations._support_tickets_no_subscription_operations import ( build_check_name_availability_request, build_create_request, @@ -38,6 +40,7 @@ build_list_request, build_update_request, ) +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +60,10 @@ class SupportTicketsNoSubscriptionOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def check_name_availability( @@ -115,7 +118,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -146,7 +149,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -161,7 +163,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -172,13 +174,13 @@ async def check_name_availability( def list( self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.SupportTicketDetails"]: - """Lists all the support tickets. :code:`
`:code:`
`You can also filter the support + """Lists all the support tickets. :code:`
`\\ :code:`
`You can also filter the support tickets by :code:`Status`, :code:`CreatedDate`, , :code:`ServiceId`, and :code:`ProblemClassificationId` using the $filter parameter. Output will be a paged result with :code:`nextLink`, using which you can retrieve the next set of support - tickets. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. + tickets. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after + ticket creation. If a ticket was created more than 18 months ago, a request for data might + cause an error. :param top: The number of values to return in the collection. Default is 25 and max is 100. Default value is None. @@ -186,7 +188,7 @@ def list( :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. :code:`
Learn more` - :code:`
`:code:`Status` , :code:`ServiceId`, and + :code:`
`\\ :code:`Status` , :code:`ServiceId`, and :code:`ProblemClassificationId` filters can only be used with 'eq' operator. For :code:`CreatedDate` filter, the supported operators are 'gt' and 'ge'. When using both filters, combine them using the logical 'AND'. Default value is None. @@ -203,7 +205,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +223,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -237,7 +238,6 @@ def prepare_request(next_link=None): _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 @@ -279,7 +279,7 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -299,7 +299,6 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -314,7 +313,7 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -331,10 +330,10 @@ async def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. + in the support ticket.\\ :code:`
`\\ :code:`
`Note: The severity levels cannot be + changed if a support ticket is actively being worked upon by an Azure support engineer. In such + a case, contact your support engineer to request severity update by adding a new communication + using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -358,10 +357,10 @@ async def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. + in the support ticket.\\ :code:`
`\\ :code:`
`Note: The severity levels cannot be + changed if a support ticket is actively being worked upon by an Azure support engineer. In such + a case, contact your support engineer to request severity update by adding a new communication + using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -383,10 +382,10 @@ async def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. + in the support ticket.\\ :code:`
`\\ :code:`
`Note: The severity levels cannot be + changed if a support ticket is actively being worked upon by an Azure support engineer. In such + a case, contact your support engineer to request severity update by adding a new communication + using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -397,7 +396,7 @@ async def update( :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -429,7 +428,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -444,7 +442,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -456,8 +454,8 @@ async def _create_initial( support_ticket_name: str, create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -470,7 +468,7 @@ async def _create_initial( api_version: str = 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -489,10 +487,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -500,18 +498,20 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -527,17 +527,17 @@ async def begin_create( **kwargs: Any ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `prerequisites `_ required to create a support ticket.\\ + :code:`
`\\ :code:`
`Always call the Services and ProblemClassifications API to get the + most recent set of services and problem categories required for support ticket creation.\\ + :code:`
`\\ :code:`
`Adding attachments is not currently supported via the API. To add + a file to an existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -562,17 +562,17 @@ async def begin_create( **kwargs: Any ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `prerequisites `_ required to create a support ticket.\\ + :code:`
`\\ :code:`
`Always call the Services and ProblemClassifications API to get the + most recent set of services and problem categories required for support ticket creation.\\ + :code:`
`\\ :code:`
`Adding attachments is not currently supported via the API. To add + a file to an existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -595,17 +595,17 @@ async def begin_create( **kwargs: Any ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `prerequisites `_ required to create a support ticket.\\ + :code:`
`\\ :code:`
`Always call the Services and ProblemClassifications API to get the + most recent set of services and problem categories required for support ticket creation.\\ + :code:`
`\\ :code:`
`Adding attachments is not currently supported via the API. To add + a file to an existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -638,10 +638,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_operations.py index 2ac02397efcd..c60e7687ad6a 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,12 +18,13 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import AsyncHttpResponse, 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 @@ -30,7 +32,7 @@ from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models -from ..._vendor import _convert_request +from ..._serialization import Deserializer, Serializer from ...operations._support_tickets_operations import ( build_check_name_availability_request, build_create_request, @@ -38,6 +40,7 @@ build_list_request, build_update_request, ) +from .._configuration import MicrosoftSupportConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -57,10 +60,10 @@ class SupportTicketsOperations: 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload async def check_name_availability( @@ -115,7 +118,7 @@ async def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -147,7 +150,6 @@ async def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -162,7 +164,7 @@ async def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -174,9 +176,9 @@ def list( self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.SupportTicketDetails"]: """Lists all the support tickets for an Azure subscription. You can also filter the support - tickets by *Status*\ , *CreatedDate*\ , *ServiceId*\ , and *ProblemClassificationId* using the - $filter parameter. Output will be a paged result with *nextLink*\ , using which you can - retrieve the next set of support tickets. :code:`
`:code:`
`Support ticket data is + tickets by *Status*\\ , *CreatedDate*\\ , *ServiceId*\\ , and *ProblemClassificationId* using + the $filter parameter. Output will be a paged result with *nextLink*\\ , using which you can + retrieve the next set of support tickets. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. @@ -184,8 +186,8 @@ def list( Default value is None. :type top: int :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. - `Learn more `_. *Status*\ , - *ServiceId*\ , and *ProblemClassificationId* filters can only be used with Equals ('eq') + `Learn more `_. *Status*\\ , + *ServiceId*\\ , and *ProblemClassificationId* filters can only be used with Equals ('eq') operator. For *CreatedDate* filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. Default value is None. @@ -202,7 +204,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -221,7 +223,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -237,7 +238,6 @@ def prepare_request(next_link=None): _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 @@ -279,7 +279,7 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -300,7 +300,6 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -315,7 +314,7 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -332,10 +331,10 @@ async def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. + and your contact information in the support ticket.\\ :code:`
`\\ :code:`
`Note: The + severity levels cannot be changed if a support ticket is actively being worked upon by an Azure + support engineer. In such a case, contact your support engineer to request severity update by + adding a new communication using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -359,10 +358,10 @@ async def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. + and your contact information in the support ticket.\\ :code:`
`\\ :code:`
`Note: The + severity levels cannot be changed if a support ticket is actively being worked upon by an Azure + support engineer. In such a case, contact your support engineer to request severity update by + adding a new communication using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -384,10 +383,10 @@ async def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. + and your contact information in the support ticket.\\ :code:`
`\\ :code:`
`Note: The + severity levels cannot be changed if a support ticket is actively being worked upon by an Azure + support engineer. In such a case, contact your support engineer to request severity update by + adding a new communication using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -398,7 +397,7 @@ async def update( :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -431,7 +430,6 @@ async def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -446,7 +444,7 @@ async def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -458,8 +456,8 @@ async def _create_initial( support_ticket_name: str, create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - error_map = { + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +470,7 @@ async def _create_initial( api_version: str = 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -492,10 +490,10 @@ async def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -503,13 +501,15 @@ async def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -527,19 +527,19 @@ async def begin_create( ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `_ required to create a support ticket.\\ :code:`
`\\ + :code:`
`Always call the Services and ProblemClassifications API to get the most recent set + of services and problem categories required for support ticket creation.\\ :code:`
`\\ + :code:`
`Adding attachments is not currently supported via the API. To add a file to an + existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`\\ **Creating a support + ticket for on-behalf-of**\\ : Include *x-ms-authorization-auxiliary* header to provide an + auxiliary token as per `documentation `_. The primary token will be from the tenant for whom a support ticket is being raised against the subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be @@ -569,19 +569,19 @@ async def begin_create( ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `_ required to create a support ticket.\\ :code:`
`\\ + :code:`
`Always call the Services and ProblemClassifications API to get the most recent set + of services and problem categories required for support ticket creation.\\ :code:`
`\\ + :code:`
`Adding attachments is not currently supported via the API. To add a file to an + existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`\\ **Creating a support + ticket for on-behalf-of**\\ : Include *x-ms-authorization-auxiliary* header to provide an + auxiliary token as per `documentation `_. The primary token will be from the tenant for whom a support ticket is being raised against the subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be @@ -609,19 +609,19 @@ async def begin_create( ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `_ required to create a support ticket.\\ :code:`
`\\ + :code:`
`Always call the Services and ProblemClassifications API to get the most recent set + of services and problem categories required for support ticket creation.\\ :code:`
`\\ + :code:`
`Adding attachments is not currently supported via the API. To add a file to an + existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`\\ **Creating a support + ticket for on-behalf-of**\\ : Include *x-ms-authorization-auxiliary* header to provide an + auxiliary token as per `documentation `_. The primary token will be from the tenant for whom a support ticket is being raised against the subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be @@ -658,10 +658,11 @@ async def begin_create( params=_params, **kwargs ) + await raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/__init__.py index 57c65d599461..dcdab5158167 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/__init__.py @@ -5,57 +5,77 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import ChatTranscriptDetails -from ._models_py3 import ChatTranscriptsListResult -from ._models_py3 import CheckNameAvailabilityInput -from ._models_py3 import CheckNameAvailabilityOutput -from ._models_py3 import CommunicationDetails -from ._models_py3 import CommunicationsListResult -from ._models_py3 import ContactProfile -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import FileDetails -from ._models_py3 import FileWorkspaceDetails -from ._models_py3 import FilesListResult -from ._models_py3 import MessageProperties -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationsListResult -from ._models_py3 import ProblemClassification -from ._models_py3 import ProblemClassificationsListResult -from ._models_py3 import ProxyResource -from ._models_py3 import QuotaChangeRequest -from ._models_py3 import QuotaTicketDetails -from ._models_py3 import Resource -from ._models_py3 import SecondaryConsent -from ._models_py3 import SecondaryConsentEnabled -from ._models_py3 import Service -from ._models_py3 import ServiceLevelAgreement -from ._models_py3 import ServicesListResult -from ._models_py3 import SupportEngineer -from ._models_py3 import SupportTicketDetails -from ._models_py3 import SupportTicketsListResult -from ._models_py3 import SystemData -from ._models_py3 import TechnicalTicketDetails -from ._models_py3 import UpdateContactProfile -from ._models_py3 import UpdateSupportTicket -from ._models_py3 import UploadFile +from typing import TYPE_CHECKING -from ._microsoft_support_enums import CommunicationDirection -from ._microsoft_support_enums import CommunicationType -from ._microsoft_support_enums import Consent -from ._microsoft_support_enums import CreatedByType -from ._microsoft_support_enums import IsTemporaryTicket -from ._microsoft_support_enums import PreferredContactMethod -from ._microsoft_support_enums import SeverityLevel -from ._microsoft_support_enums import Status -from ._microsoft_support_enums import TranscriptContentType -from ._microsoft_support_enums import Type -from ._microsoft_support_enums import UserConsent +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models_py3 import ( # type: ignore + ChatTranscriptDetails, + ChatTranscriptsListResult, + CheckNameAvailabilityInput, + CheckNameAvailabilityOutput, + ClassificationService, + CommunicationDetails, + CommunicationsListResult, + ContactProfile, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + FileDetails, + FileWorkspaceDetails, + FilesListResult, + LookUpResourceIdRequest, + LookUpResourceIdResponse, + MessageProperties, + Operation, + OperationDisplay, + OperationsListResult, + ProblemClassification, + ProblemClassificationsClassificationInput, + ProblemClassificationsClassificationOutput, + ProblemClassificationsClassificationResult, + ProblemClassificationsListResult, + ProxyResource, + QuotaChangeRequest, + QuotaTicketDetails, + Resource, + SecondaryConsent, + SecondaryConsentEnabled, + Service, + ServiceClassificationAnswer, + ServiceClassificationOutput, + ServiceClassificationRequest, + ServiceLevelAgreement, + ServicesListResult, + SupportEngineer, + SupportTicketDetails, + SupportTicketsListResult, + SystemData, + TechnicalTicketDetails, + UpdateContactProfile, + UpdateSupportTicket, + UploadFile, +) + +from ._microsoft_support_enums import ( # type: ignore + CommunicationDirection, + CommunicationType, + Consent, + CreatedByType, + IsTemporaryTicket, + PreferredContactMethod, + SeverityLevel, + Status, + TranscriptContentType, + Type, + UserConsent, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ @@ -63,6 +83,7 @@ "ChatTranscriptsListResult", "CheckNameAvailabilityInput", "CheckNameAvailabilityOutput", + "ClassificationService", "CommunicationDetails", "CommunicationsListResult", "ContactProfile", @@ -72,11 +93,16 @@ "FileDetails", "FileWorkspaceDetails", "FilesListResult", + "LookUpResourceIdRequest", + "LookUpResourceIdResponse", "MessageProperties", "Operation", "OperationDisplay", "OperationsListResult", "ProblemClassification", + "ProblemClassificationsClassificationInput", + "ProblemClassificationsClassificationOutput", + "ProblemClassificationsClassificationResult", "ProblemClassificationsListResult", "ProxyResource", "QuotaChangeRequest", @@ -85,6 +111,9 @@ "SecondaryConsent", "SecondaryConsentEnabled", "Service", + "ServiceClassificationAnswer", + "ServiceClassificationOutput", + "ServiceClassificationRequest", "ServiceLevelAgreement", "ServicesListResult", "SupportEngineer", @@ -107,5 +136,5 @@ "Type", "UserConsent", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models_py3.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models_py3.py index cb92810f43f2..f7673509009a 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models_py3.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models_py3.py @@ -1,5 +1,5 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 -# pylint: disable=too-many-lines # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. @@ -8,12 +8,11 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports from .. import models as _models @@ -23,7 +22,7 @@ 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. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -52,10 +51,10 @@ class Resource(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.system_data: Optional["_models.SystemData"] = None class ProxyResource(Resource): @@ -65,7 +64,7 @@ class ProxyResource(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}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -84,7 +83,7 @@ class ChatTranscriptDetails(ProxyResource): 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}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -124,7 +123,7 @@ def __init__(self, *, messages: Optional[List["_models.MessageProperties"]] = No """ super().__init__(**kwargs) self.messages = messages - self.start_time = None + self.start_time: Optional[datetime.datetime] = None class ChatTranscriptsListResult(_serialization.Model): @@ -222,9 +221,44 @@ class CheckNameAvailabilityOutput(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None + self.name_available: Optional[bool] = None + self.reason: Optional[str] = None + self.message: Optional[str] = None + + +class ClassificationService(_serialization.Model): + """Service Classification result object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_id: Azure resource Id of the service. + :vartype service_id: str + :ivar display_name: Localized name of the azure service. + :vartype display_name: str + :ivar resource_types: List of applicable ARM resource types for this service. + :vartype resource_types: list[str] + """ + + _validation = { + "service_id": {"readonly": True}, + "display_name": {"readonly": True}, + } + + _attribute_map = { + "service_id": {"key": "serviceId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "resource_types": {"key": "resourceTypes", "type": "[str]"}, + } + + def __init__(self, *, resource_types: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword resource_types: List of applicable ARM resource types for this service. + :paramtype resource_types: list[str] + """ + super().__init__(**kwargs) + self.service_id: Optional[str] = None + self.display_name: Optional[str] = None + self.resource_types = resource_types class CommunicationDetails(_serialization.Model): @@ -232,8 +266,6 @@ class CommunicationDetails(_serialization.Model): 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 server. - :ivar id: Id of the resource. :vartype id: str :ivar name: Name of the resource. @@ -248,9 +280,9 @@ class CommunicationDetails(_serialization.Model): :ivar sender: Email address of the sender. This property is required if called by a service principal. :vartype sender: str - :ivar subject: Subject of the communication. Required. + :ivar subject: Subject of the communication. :vartype subject: str - :ivar body: Body of the communication. Required. + :ivar body: Body of the communication. :vartype body: str :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. :vartype created_date: ~datetime.datetime @@ -262,8 +294,6 @@ class CommunicationDetails(_serialization.Model): "type": {"readonly": True}, "communication_type": {"readonly": True}, "communication_direction": {"readonly": True}, - "subject": {"required": True}, - "body": {"required": True}, "created_date": {"readonly": True}, } @@ -279,26 +309,28 @@ class CommunicationDetails(_serialization.Model): "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, } - def __init__(self, *, subject: str, body: str, sender: Optional[str] = None, **kwargs: Any) -> None: + def __init__( + self, *, sender: Optional[str] = None, subject: Optional[str] = None, body: Optional[str] = None, **kwargs: Any + ) -> None: """ :keyword sender: Email address of the sender. This property is required if called by a service principal. :paramtype sender: str - :keyword subject: Subject of the communication. Required. + :keyword subject: Subject of the communication. :paramtype subject: str - :keyword body: Body of the communication. Required. + :keyword body: Body of the communication. :paramtype body: str """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.communication_type = None - self.communication_direction = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None + self.communication_type: Optional[Union[str, "_models.CommunicationType"]] = None + self.communication_direction: Optional[Union[str, "_models.CommunicationDirection"]] = None self.sender = sender self.subject = subject self.body = body - self.created_date = None + self.created_date: Optional[datetime.datetime] = None class CommunicationsListResult(_serialization.Model): @@ -350,7 +382,8 @@ class ContactProfile(_serialization.Model): :ivar additional_email_addresses: Additional email addresses listed will be copied on any correspondence about the support ticket. :vartype additional_email_addresses: list[str] - :ivar phone_number: Phone number. This is required if preferred contact method is phone. + :ivar phone_number: Phone number. This is required if preferred contact method is phone. It is + also required when submitting 'critical' or 'highestcriticalimpact' severity cases. :vartype phone_number: str :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values @@ -417,7 +450,8 @@ def __init__( :keyword additional_email_addresses: Additional email addresses listed will be copied on any correspondence about the support ticket. :paramtype additional_email_addresses: list[str] - :keyword phone_number: Phone number. This is required if preferred contact method is phone. + :keyword phone_number: Phone number. This is required if preferred contact method is phone. It + is also required when submitting 'critical' or 'highestcriticalimpact' severity cases. :paramtype phone_number: str :keyword preferred_time_zone: Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values @@ -470,8 +504,8 @@ class ErrorAdditionalInfo(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.type = None - self.info = None + self.type: Optional[str] = None + self.info: Optional[JSON] = None class ErrorDetail(_serialization.Model): @@ -510,11 +544,11 @@ class ErrorDetail(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None + self.code: Optional[str] = None + self.message: Optional[str] = None + self.target: Optional[str] = None + self.details: Optional[List["_models.ErrorDetail"]] = None + self.additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = None class ErrorResponse(_serialization.Model): @@ -544,7 +578,7 @@ class FileDetails(ProxyResource): 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}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -556,14 +590,11 @@ class FileDetails(ProxyResource): :vartype system_data: ~azure.mgmt.support.models.SystemData :ivar created_on: Time in UTC (ISO 8601 format) when file workspace was created. :vartype created_on: ~datetime.datetime - :ivar chunk_size: Size of each chunk. The size of each chunk should be provided in bytes and - must not exceed 2.5 megabytes (MB). + :ivar chunk_size: Size of each chunk. :vartype chunk_size: int - :ivar file_size: Size of the file to be uploaded. The file size must not exceed 5 MB and should - be provided in bytes. + :ivar file_size: Size of the file to be uploaded. :vartype file_size: int - :ivar number_of_chunks: Number of chunks to be uploaded. The maximum number of allowed chunks - is 2. + :ivar number_of_chunks: Number of chunks to be uploaded. :vartype number_of_chunks: int """ @@ -595,18 +626,15 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword chunk_size: Size of each chunk. The size of each chunk should be provided in bytes and - must not exceed 2.5 megabytes (MB). + :keyword chunk_size: Size of each chunk. :paramtype chunk_size: int - :keyword file_size: Size of the file to be uploaded. The file size must not exceed 5 MB and - should be provided in bytes. + :keyword file_size: Size of the file to be uploaded. :paramtype file_size: int - :keyword number_of_chunks: Number of chunks to be uploaded. The maximum number of allowed - chunks is 2. + :keyword number_of_chunks: Number of chunks to be uploaded. :paramtype number_of_chunks: int """ super().__init__(**kwargs) - self.created_on = None + self.created_on: Optional[datetime.datetime] = None self.chunk_size = chunk_size self.file_size = file_size self.number_of_chunks = number_of_chunks @@ -646,7 +674,7 @@ class FileWorkspaceDetails(ProxyResource): 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}". # pylint: disable=line-too-long + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -683,8 +711,62 @@ class FileWorkspaceDetails(ProxyResource): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.created_on = None - self.expiration_time = None + self.created_on: Optional[datetime.datetime] = None + self.expiration_time: Optional[datetime.datetime] = None + + +class LookUpResourceIdRequest(_serialization.Model): + """The look up resource Id request body. + + :ivar identifier: The System generated Id that is unique. Use supportTicketId property for + Microsoft.Support/supportTickets resource type. + :vartype identifier: str + :ivar type: The type of resource. Default value is "Microsoft.Support/supportTickets". + :vartype type: str + """ + + _attribute_map = { + "identifier": {"key": "identifier", "type": "str"}, + "type": {"key": "type", "type": "str"}, + } + + def __init__( + self, + *, + identifier: Optional[str] = None, + type: Optional[Literal["Microsoft.Support/supportTickets"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword identifier: The System generated Id that is unique. Use supportTicketId property for + Microsoft.Support/supportTickets resource type. + :paramtype identifier: str + :keyword type: The type of resource. Default value is "Microsoft.Support/supportTickets". + :paramtype type: str + """ + super().__init__(**kwargs) + self.identifier = identifier + self.type = type + + +class LookUpResourceIdResponse(_serialization.Model): + """The look up resource id response. + + :ivar resource_id: The resource Id of support resource type. + :vartype resource_id: str + """ + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource Id of support resource type. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id class MessageProperties(_serialization.Model): @@ -692,6 +774,8 @@ class MessageProperties(_serialization.Model): 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 server. + :ivar content_type: Content type. :vartype content_type: str or ~azure.mgmt.support.models.TranscriptContentType :ivar communication_direction: Direction of communication. Known values are: "inbound" and @@ -699,7 +783,7 @@ class MessageProperties(_serialization.Model): :vartype communication_direction: str or ~azure.mgmt.support.models.CommunicationDirection :ivar sender: Name of the sender. :vartype sender: str - :ivar body: Body of the communication. + :ivar body: Body of the communication. Required. :vartype body: str :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. :vartype created_date: ~datetime.datetime @@ -708,6 +792,7 @@ class MessageProperties(_serialization.Model): _validation = { "content_type": {"readonly": True}, "communication_direction": {"readonly": True}, + "body": {"required": True}, "created_date": {"readonly": True}, } @@ -719,19 +804,19 @@ class MessageProperties(_serialization.Model): "created_date": {"key": "createdDate", "type": "iso-8601"}, } - def __init__(self, *, sender: Optional[str] = None, body: Optional[str] = None, **kwargs: Any) -> None: + def __init__(self, *, body: str, sender: Optional[str] = None, **kwargs: Any) -> None: """ :keyword sender: Name of the sender. :paramtype sender: str - :keyword body: Body of the communication. + :keyword body: Body of the communication. Required. :paramtype body: str """ super().__init__(**kwargs) - self.content_type = None - self.communication_direction = None + self.content_type: Optional[Union[str, "_models.TranscriptContentType"]] = None + self.communication_direction: Optional[Union[str, "_models.CommunicationDirection"]] = None self.sender = sender self.body = body - self.created_date = None + self.created_date: Optional[datetime.datetime] = None class Operation(_serialization.Model): @@ -760,7 +845,7 @@ def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kw :paramtype display: ~azure.mgmt.support.models.OperationDisplay """ super().__init__(**kwargs) - self.name = None + self.name: Optional[str] = None self.display = display @@ -796,10 +881,10 @@ class OperationDisplay(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.description = None - self.operation = None - self.provider = None - self.resource = None + self.description: Optional[str] = None + self.operation: Optional[str] = None + self.provider: Optional[str] = None + self.resource: Optional[str] = None class OperationsListResult(_serialization.Model): @@ -838,12 +923,18 @@ class ProblemClassification(_serialization.Model): :ivar secondary_consent_enabled: This property indicates whether secondary consent is present for problem classification. :vartype secondary_consent_enabled: list[~azure.mgmt.support.models.SecondaryConsentEnabled] + :ivar metadata: String-to-string dictionary for additional metadata. + :vartype metadata: dict[str, str] + :ivar parent_problem_classification: Reference to the parent problem classification which has + same structure as problem classification. + :vartype parent_problem_classification: ~azure.mgmt.support.models.ProblemClassification """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "metadata": {"readonly": True}, } _attribute_map = { @@ -852,6 +943,11 @@ class ProblemClassification(_serialization.Model): "type": {"key": "type", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "secondary_consent_enabled": {"key": "properties.secondaryConsentEnabled", "type": "[SecondaryConsentEnabled]"}, + "metadata": {"key": "properties.metadata", "type": "{str}"}, + "parent_problem_classification": { + "key": "properties.parentProblemClassification", + "type": "ProblemClassification", + }, } def __init__( @@ -859,6 +955,7 @@ def __init__( *, display_name: Optional[str] = None, secondary_consent_enabled: Optional[List["_models.SecondaryConsentEnabled"]] = None, + parent_problem_classification: Optional["_models.ProblemClassification"] = None, **kwargs: Any ) -> None: """ @@ -867,13 +964,140 @@ def __init__( :keyword secondary_consent_enabled: This property indicates whether secondary consent is present for problem classification. :paramtype secondary_consent_enabled: list[~azure.mgmt.support.models.SecondaryConsentEnabled] + :keyword parent_problem_classification: Reference to the parent problem classification which + has same structure as problem classification. + :paramtype parent_problem_classification: ~azure.mgmt.support.models.ProblemClassification """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.display_name = display_name self.secondary_consent_enabled = secondary_consent_enabled + self.metadata: Optional[Dict[str, str]] = None + self.parent_problem_classification = parent_problem_classification + + +class ProblemClassificationsClassificationInput(_serialization.Model): # pylint: disable=name-too-long + """Input to problem classification Classification API. + + All required parameters must be populated in order to send to server. + + :ivar issue_summary: Natural language description of the customer’s issue. Required. + :vartype issue_summary: str + :ivar resource_id: ARM resource Id of the resource that is having the issue. + :vartype resource_id: str + """ + + _validation = { + "issue_summary": {"required": True}, + } + + _attribute_map = { + "issue_summary": {"key": "issueSummary", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, issue_summary: str, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword issue_summary: Natural language description of the customer’s issue. Required. + :paramtype issue_summary: str + :keyword resource_id: ARM resource Id of the resource that is having the issue. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.issue_summary = issue_summary + self.resource_id = resource_id + + +class ProblemClassificationsClassificationOutput(_serialization.Model): # pylint: disable=name-too-long + """Output of the problem classification Classification API. + + :ivar problem_classification_results: Set of problem classification objects classified. + :vartype problem_classification_results: + list[~azure.mgmt.support.models.ProblemClassificationsClassificationResult] + """ + + _attribute_map = { + "problem_classification_results": { + "key": "problemClassificationResults", + "type": "[ProblemClassificationsClassificationResult]", + }, + } + + def __init__( + self, + *, + problem_classification_results: Optional[List["_models.ProblemClassificationsClassificationResult"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword problem_classification_results: Set of problem classification objects classified. + :paramtype problem_classification_results: + list[~azure.mgmt.support.models.ProblemClassificationsClassificationResult] + """ + super().__init__(**kwargs) + self.problem_classification_results = problem_classification_results + + +class ProblemClassificationsClassificationResult(_serialization.Model): # pylint: disable=name-too-long + """ProblemClassification Classification result object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar problem_id: Identifier that may be used for solution discovery or some other purposes. + :vartype problem_id: str + :ivar title: Title of the problem classification result. + :vartype title: str + :ivar description: Description of the problem classification result. + :vartype description: str + :ivar service_id: Identifier of the service associated with this problem classification result. + :vartype service_id: str + :ivar problem_classification_id: Identifier that may be used for support ticket creation. + :vartype problem_classification_id: str + :ivar service_id_related_service_id: Azure resource Id of the service. + :vartype service_id_related_service_id: str + :ivar display_name: Localized name of the azure service. + :vartype display_name: str + :ivar resource_types: List of applicable ARM resource types for this service. + :vartype resource_types: list[str] + """ + + _validation = { + "problem_id": {"readonly": True}, + "title": {"readonly": True}, + "description": {"readonly": True}, + "service_id": {"readonly": True}, + "problem_classification_id": {"readonly": True}, + "service_id_related_service_id": {"readonly": True}, + "display_name": {"readonly": True}, + } + + _attribute_map = { + "problem_id": {"key": "problemId", "type": "str"}, + "title": {"key": "title", "type": "str"}, + "description": {"key": "description", "type": "str"}, + "service_id": {"key": "serviceId", "type": "str"}, + "problem_classification_id": {"key": "problemClassificationId", "type": "str"}, + "service_id_related_service_id": {"key": "relatedService.serviceId", "type": "str"}, + "display_name": {"key": "relatedService.displayName", "type": "str"}, + "resource_types": {"key": "relatedService.resourceTypes", "type": "[str]"}, + } + + def __init__(self, *, resource_types: Optional[List[str]] = None, **kwargs: Any) -> None: + """ + :keyword resource_types: List of applicable ARM resource types for this service. + :paramtype resource_types: list[str] + """ + super().__init__(**kwargs) + self.problem_id: Optional[str] = None + self.title: Optional[str] = None + self.description: Optional[str] = None + self.service_id: Optional[str] = None + self.problem_classification_id: Optional[str] = None + self.service_id_related_service_id: Optional[str] = None + self.display_name: Optional[str] = None + self.resource_types = resource_types class ProblemClassificationsListResult(_serialization.Model): @@ -1042,12 +1266,15 @@ class Service(_serialization.Model): :vartype display_name: str :ivar resource_types: ARM Resource types. :vartype resource_types: list[str] + :ivar metadata: Metadata about the service, only visible for 1P clients. + :vartype metadata: dict[str, str] """ _validation = { "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, + "metadata": {"readonly": True}, } _attribute_map = { @@ -1056,6 +1283,7 @@ class Service(_serialization.Model): "type": {"key": "type", "type": "str"}, "display_name": {"key": "properties.displayName", "type": "str"}, "resource_types": {"key": "properties.resourceTypes", "type": "[str]"}, + "metadata": {"key": "properties.metadata", "type": "{str}"}, } def __init__( @@ -1068,11 +1296,125 @@ def __init__( :paramtype resource_types: list[str] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.display_name = display_name self.resource_types = resource_types + self.metadata: Optional[Dict[str, str]] = None + + +class ServiceClassificationAnswer(ClassificationService): + """Service Classification result object. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar service_id: Azure resource Id of the service. + :vartype service_id: str + :ivar display_name: Localized name of the azure service. + :vartype display_name: str + :ivar resource_types: List of applicable ARM resource types for this service. + :vartype resource_types: list[str] + :ivar child_service: Child service. + :vartype child_service: ~azure.mgmt.support.models.ClassificationService + """ + + _validation = { + "service_id": {"readonly": True}, + "display_name": {"readonly": True}, + } + + _attribute_map = { + "service_id": {"key": "serviceId", "type": "str"}, + "display_name": {"key": "displayName", "type": "str"}, + "resource_types": {"key": "resourceTypes", "type": "[str]"}, + "child_service": {"key": "childService", "type": "ClassificationService"}, + } + + def __init__( + self, + *, + resource_types: Optional[List[str]] = None, + child_service: Optional["_models.ClassificationService"] = None, + **kwargs: Any + ) -> None: + """ + :keyword resource_types: List of applicable ARM resource types for this service. + :paramtype resource_types: list[str] + :keyword child_service: Child service. + :paramtype child_service: ~azure.mgmt.support.models.ClassificationService + """ + super().__init__(resource_types=resource_types, **kwargs) + self.child_service = child_service + + +class ServiceClassificationOutput(_serialization.Model): + """Output of the service classification API. + + :ivar service_classification_results: Set of problem classification objects classified. + :vartype service_classification_results: + list[~azure.mgmt.support.models.ServiceClassificationAnswer] + """ + + _attribute_map = { + "service_classification_results": { + "key": "serviceClassificationResults", + "type": "[ServiceClassificationAnswer]", + }, + } + + def __init__( + self, + *, + service_classification_results: Optional[List["_models.ServiceClassificationAnswer"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword service_classification_results: Set of problem classification objects classified. + :paramtype service_classification_results: + list[~azure.mgmt.support.models.ServiceClassificationAnswer] + """ + super().__init__(**kwargs) + self.service_classification_results = service_classification_results + + +class ServiceClassificationRequest(_serialization.Model): + """Input to problem classification Classification API. + + :ivar issue_summary: Natural language description of the customer’s issue. + :vartype issue_summary: str + :ivar resource_id: ARM resource Id of the resource that is having the issue. + :vartype resource_id: str + :ivar additional_context: Additional information in the form of a string. + :vartype additional_context: str + """ + + _attribute_map = { + "issue_summary": {"key": "issueSummary", "type": "str"}, + "resource_id": {"key": "resourceId", "type": "str"}, + "additional_context": {"key": "additionalContext", "type": "str"}, + } + + def __init__( + self, + *, + issue_summary: Optional[str] = None, + resource_id: Optional[str] = None, + additional_context: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword issue_summary: Natural language description of the customer’s issue. + :paramtype issue_summary: str + :keyword resource_id: ARM resource Id of the resource that is having the issue. + :paramtype resource_id: str + :keyword additional_context: Additional information in the form of a string. + :paramtype additional_context: str + """ + super().__init__(**kwargs) + self.issue_summary = issue_summary + self.resource_id = resource_id + self.additional_context = additional_context class ServiceLevelAgreement(_serialization.Model): @@ -1103,9 +1445,9 @@ class ServiceLevelAgreement(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.start_time = None - self.expiration_time = None - self.sla_minutes = None + self.start_time: Optional[datetime.datetime] = None + self.expiration_time: Optional[datetime.datetime] = None + self.sla_minutes: Optional[int] = None class ServicesListResult(_serialization.Model): @@ -1149,16 +1491,14 @@ class SupportEngineer(_serialization.Model): def __init__(self, **kwargs: Any) -> None: """ """ super().__init__(**kwargs) - self.email_address = None + self.email_address: Optional[str] = None -class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes +class SupportTicketDetails(_serialization.Model): """Object that represents SupportTicketDetails resource. 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 server. - :ivar id: Id of the resource. :vartype id: str :ivar name: Name of the resource. @@ -1167,33 +1507,32 @@ class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-in :vartype type: str :ivar support_ticket_id: System generated support ticket Id that is unique. :vartype support_ticket_id: str - :ivar description: Detailed description of the question or issue. Required. + :ivar description: Detailed description of the question or issue. :vartype description: str :ivar problem_classification_id: Each Azure service has its own set of issue categories, also known as problem classification. This parameter is the unique Id for the type of problem you - are experiencing. Required. + are experiencing. :vartype problem_classification_id: str :ivar problem_classification_display_name: Localized name of problem classification. :vartype problem_classification_display_name: str :ivar severity: A value that indicates the urgency of the case, which in turn determines the response time according to the service level agreement of the technical support plan you have with Azure. Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' - level in the Azure portal is reserved only for our Premium customers. Required. Known values - are: "minimal", "moderate", "critical", and "highestcriticalimpact". + level in the Azure portal is reserved only for our Premium customers. Known values are: + "minimal", "moderate", "critical", and "highestcriticalimpact". :vartype severity: str or ~azure.mgmt.support.models.SeverityLevel :ivar enrollment_id: Enrollment Id associated with the support ticket. :vartype enrollment_id: str :ivar require24_x7_response: Indicates if this requires a 24x7 response from Azure. :vartype require24_x7_response: bool :ivar advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support - ticket. Required. Known values are: "Yes" and "No". + ticket. Known values are: "Yes" and "No". :vartype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent :ivar problem_scoping_questions: Problem scoping questions associated with the support ticket. :vartype problem_scoping_questions: str :ivar support_plan_id: Support plan id associated with the support ticket. :vartype support_plan_id: str :ivar contact_details: Contact information of the user requesting to create a support ticket. - Required. :vartype contact_details: ~azure.mgmt.support.models.ContactProfile :ivar service_level_agreement: Service Level Agreement information for this support ticket. :vartype service_level_agreement: ~azure.mgmt.support.models.ServiceLevelAgreement @@ -1203,12 +1542,12 @@ class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-in :vartype support_plan_type: str :ivar support_plan_display_name: Support plan type associated with the support ticket. :vartype support_plan_display_name: str - :ivar title: Title of the support ticket. Required. + :ivar title: Title of the support ticket. :vartype title: str :ivar problem_start_time: Time in UTC (ISO 8601 format) when the problem started. :vartype problem_start_time: ~datetime.datetime :ivar service_id: This is the resource Id of the Azure service resource associated with the - support ticket. Required. + support ticket. :vartype service_id: str :ivar service_display_name: Localized name of the Azure service. :vartype service_display_name: str @@ -1237,16 +1576,9 @@ class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-in "id": {"readonly": True}, "name": {"readonly": True}, "type": {"readonly": True}, - "description": {"required": True}, - "problem_classification_id": {"required": True}, "problem_classification_display_name": {"readonly": True}, - "severity": {"required": True}, - "advanced_diagnostic_consent": {"required": True}, - "contact_details": {"required": True}, "support_plan_type": {"readonly": True}, "support_plan_display_name": {"readonly": True}, - "title": {"required": True}, - "service_id": {"required": True}, "service_display_name": {"readonly": True}, "status": {"readonly": True}, "created_date": {"readonly": True}, @@ -1290,21 +1622,21 @@ class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-in def __init__( # pylint: disable=too-many-locals self, *, - description: str, - problem_classification_id: str, - severity: Union[str, "_models.SeverityLevel"], - advanced_diagnostic_consent: Union[str, "_models.Consent"], - contact_details: "_models.ContactProfile", - title: str, - service_id: str, support_ticket_id: Optional[str] = None, + description: Optional[str] = None, + problem_classification_id: Optional[str] = None, + severity: Optional[Union[str, "_models.SeverityLevel"]] = None, enrollment_id: Optional[str] = None, require24_x7_response: Optional[bool] = None, + advanced_diagnostic_consent: Optional[Union[str, "_models.Consent"]] = None, problem_scoping_questions: Optional[str] = None, support_plan_id: Optional[str] = None, + contact_details: Optional["_models.ContactProfile"] = None, service_level_agreement: Optional["_models.ServiceLevelAgreement"] = None, support_engineer: Optional["_models.SupportEngineer"] = None, + title: Optional[str] = None, problem_start_time: Optional[datetime.datetime] = None, + service_id: Optional[str] = None, file_workspace_name: Optional[str] = None, technical_ticket_details: Optional["_models.TechnicalTicketDetails"] = None, quota_ticket_details: Optional["_models.QuotaTicketDetails"] = None, @@ -1314,24 +1646,24 @@ def __init__( # pylint: disable=too-many-locals """ :keyword support_ticket_id: System generated support ticket Id that is unique. :paramtype support_ticket_id: str - :keyword description: Detailed description of the question or issue. Required. + :keyword description: Detailed description of the question or issue. :paramtype description: str :keyword problem_classification_id: Each Azure service has its own set of issue categories, also known as problem classification. This parameter is the unique Id for the type of problem - you are experiencing. Required. + you are experiencing. :paramtype problem_classification_id: str :keyword severity: A value that indicates the urgency of the case, which in turn determines the response time according to the service level agreement of the technical support plan you have with Azure. Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' - level in the Azure portal is reserved only for our Premium customers. Required. Known values - are: "minimal", "moderate", "critical", and "highestcriticalimpact". + level in the Azure portal is reserved only for our Premium customers. Known values are: + "minimal", "moderate", "critical", and "highestcriticalimpact". :paramtype severity: str or ~azure.mgmt.support.models.SeverityLevel :keyword enrollment_id: Enrollment Id associated with the support ticket. :paramtype enrollment_id: str :keyword require24_x7_response: Indicates if this requires a 24x7 response from Azure. :paramtype require24_x7_response: bool :keyword advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support - ticket. Required. Known values are: "Yes" and "No". + ticket. Known values are: "Yes" and "No". :paramtype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent :keyword problem_scoping_questions: Problem scoping questions associated with the support ticket. @@ -1339,19 +1671,19 @@ def __init__( # pylint: disable=too-many-locals :keyword support_plan_id: Support plan id associated with the support ticket. :paramtype support_plan_id: str :keyword contact_details: Contact information of the user requesting to create a support - ticket. Required. + ticket. :paramtype contact_details: ~azure.mgmt.support.models.ContactProfile :keyword service_level_agreement: Service Level Agreement information for this support ticket. :paramtype service_level_agreement: ~azure.mgmt.support.models.ServiceLevelAgreement :keyword support_engineer: Information about the support engineer working on this support ticket. :paramtype support_engineer: ~azure.mgmt.support.models.SupportEngineer - :keyword title: Title of the support ticket. Required. + :keyword title: Title of the support ticket. :paramtype title: str :keyword problem_start_time: Time in UTC (ISO 8601 format) when the problem started. :paramtype problem_start_time: ~datetime.datetime :keyword service_id: This is the resource Id of the Azure service resource associated with the - support ticket. Required. + support ticket. :paramtype service_id: str :keyword file_workspace_name: File workspace name. :paramtype file_workspace_name: str @@ -1365,13 +1697,13 @@ def __init__( # pylint: disable=too-many-locals :paramtype secondary_consent: list[~azure.mgmt.support.models.SecondaryConsent] """ super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None + self.id: Optional[str] = None + self.name: Optional[str] = None + self.type: Optional[str] = None self.support_ticket_id = support_ticket_id self.description = description self.problem_classification_id = problem_classification_id - self.problem_classification_display_name = None + self.problem_classification_display_name: Optional[str] = None self.severity = severity self.enrollment_id = enrollment_id self.require24_x7_response = require24_x7_response @@ -1381,17 +1713,17 @@ def __init__( # pylint: disable=too-many-locals self.contact_details = contact_details self.service_level_agreement = service_level_agreement self.support_engineer = support_engineer - self.support_plan_type = None - self.support_plan_display_name = None + self.support_plan_type: Optional[str] = None + self.support_plan_display_name: Optional[str] = None self.title = title self.problem_start_time = problem_start_time self.service_id = service_id - self.service_display_name = None - self.status = None - self.created_date = None - self.modified_date = None + self.service_display_name: Optional[str] = None + self.status: Optional[str] = None + self.created_date: Optional[datetime.datetime] = None + self.modified_date: Optional[datetime.datetime] = None self.file_workspace_name = file_workspace_name - self.is_temporary_ticket = None + self.is_temporary_ticket: Optional[Union[str, "_models.IsTemporaryTicket"]] = None self.technical_ticket_details = technical_ticket_details self.quota_ticket_details = quota_ticket_details self.secondary_consent = secondary_consent @@ -1530,7 +1862,8 @@ class UpdateContactProfile(_serialization.Model): :ivar additional_email_addresses: Email addresses listed will be copied on any correspondence about the support ticket. :vartype additional_email_addresses: list[str] - :ivar phone_number: Phone number. This is required if preferred contact method is phone. + :ivar phone_number: Phone number. This is required if preferred contact method is phone. It is + also required when submitting 'critical' or 'highestcriticalimpact' severity cases. :vartype phone_number: str :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values @@ -1586,7 +1919,8 @@ def __init__( :keyword additional_email_addresses: Email addresses listed will be copied on any correspondence about the support ticket. :paramtype additional_email_addresses: list[str] - :keyword phone_number: Phone number. This is required if preferred contact method is phone. + :keyword phone_number: Phone number. This is required if preferred contact method is phone. It + is also required when submitting 'critical' or 'highestcriticalimpact' severity cases. :paramtype phone_number: str :keyword preferred_time_zone: Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values @@ -1616,8 +1950,7 @@ def __init__( class UpdateSupportTicket(_serialization.Model): - """Updates severity, ticket status, contact details, advanced diagnostic consent and secondary - consent in the support ticket. + """Updates severity, ticket status, and contact details in the support ticket. :ivar severity: Severity level. Known values are: "minimal", "moderate", "critical", and "highestcriticalimpact". diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/__init__.py index 7700443bd45e..88513a436ac0 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/__init__.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,28 +6,41 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._services_operations import ServicesOperations -from ._problem_classifications_operations import ProblemClassificationsOperations -from ._support_tickets_operations import SupportTicketsOperations -from ._support_tickets_no_subscription_operations import SupportTicketsNoSubscriptionOperations -from ._communications_operations import CommunicationsOperations -from ._communications_no_subscription_operations import CommunicationsNoSubscriptionOperations -from ._chat_transcripts_operations import ChatTranscriptsOperations -from ._chat_transcripts_no_subscription_operations import ChatTranscriptsNoSubscriptionOperations -from ._file_workspaces_operations import FileWorkspacesOperations -from ._file_workspaces_no_subscription_operations import FileWorkspacesNoSubscriptionOperations -from ._files_operations import FilesOperations -from ._files_no_subscription_operations import FilesNoSubscriptionOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._services_operations import ServicesOperations # type: ignore +from ._service_classifications_no_subscription_operations import ServiceClassificationsNoSubscriptionOperations # type: ignore +from ._service_classifications_operations import ServiceClassificationsOperations # type: ignore +from ._problem_classifications_no_subscription_operations import ProblemClassificationsNoSubscriptionOperations # type: ignore +from ._problem_classifications_operations import ProblemClassificationsOperations # type: ignore +from ._support_tickets_operations import SupportTicketsOperations # type: ignore +from ._support_tickets_no_subscription_operations import SupportTicketsNoSubscriptionOperations # type: ignore +from ._communications_operations import CommunicationsOperations # type: ignore +from ._communications_no_subscription_operations import CommunicationsNoSubscriptionOperations # type: ignore +from ._chat_transcripts_operations import ChatTranscriptsOperations # type: ignore +from ._chat_transcripts_no_subscription_operations import ChatTranscriptsNoSubscriptionOperations # type: ignore +from ._file_workspaces_operations import FileWorkspacesOperations # type: ignore +from ._file_workspaces_no_subscription_operations import FileWorkspacesNoSubscriptionOperations # type: ignore +from ._files_operations import FilesOperations # type: ignore +from ._files_no_subscription_operations import FilesNoSubscriptionOperations # type: ignore +from ._look_up_resource_id_operations import LookUpResourceIdOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "ServicesOperations", + "ServiceClassificationsNoSubscriptionOperations", + "ServiceClassificationsOperations", + "ProblemClassificationsNoSubscriptionOperations", "ProblemClassificationsOperations", "SupportTicketsOperations", "SupportTicketsNoSubscriptionOperations", @@ -38,6 +52,7 @@ "FileWorkspacesNoSubscriptionOperations", "FilesOperations", "FilesNoSubscriptionOperations", + "LookUpResourceIdOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_no_subscription_operations.py index c422366064be..6ce70338e0db 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,15 +20,14 @@ ) 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.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ def build_list_request(support_ticket_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,14 +64,14 @@ def build_get_request(support_ticket_name: str, chat_transcript_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "chatTranscriptName": _SERIALIZER.url("chat_transcript_name", chat_transcript_name, "str"), @@ -102,10 +102,10 @@ class ChatTranscriptsNoSubscriptionOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.ChatTranscriptDetails"]: @@ -124,7 +124,7 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.Cha api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -141,7 +141,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -157,7 +156,6 @@ def prepare_request(next_link=None): _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 @@ -199,7 +197,7 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -220,7 +218,6 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -235,7 +232,7 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) + deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_operations.py index 1f47a12e2ffc..fb1391c964bf 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +6,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,15 +21,14 @@ ) 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.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,14 +41,14 @@ def build_list_request(support_ticket_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -70,14 +71,14 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "chatTranscriptName": _SERIALIZER.url("chat_transcript_name", chat_transcript_name, "str"), @@ -109,10 +110,10 @@ class ChatTranscriptsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.ChatTranscriptDetails"]: @@ -131,7 +132,7 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.Cha api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -149,7 +150,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -165,7 +165,6 @@ def prepare_request(next_link=None): _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 @@ -207,7 +206,7 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -229,7 +228,6 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -244,7 +242,7 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) + deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_no_subscription_operations.py index 1b9c73cd0c63..3bd611f58312 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,31 +5,34 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,14 +45,14 @@ def build_check_name_availability_request(support_ticket_name: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), } @@ -74,7 +76,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,14 +104,14 @@ def build_get_request(support_ticket_name: str, communication_name: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), @@ -130,7 +132,7 @@ def build_create_request(support_ticket_name: str, communication_name: str, **kw _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -138,7 +140,7 @@ def build_create_request(support_ticket_name: str, communication_name: str, **kw _url = kwargs.pop( "template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), @@ -171,10 +173,10 @@ class CommunicationsNoSubscriptionOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def check_name_availability( @@ -244,7 +246,7 @@ def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -276,7 +278,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -291,7 +292,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -305,10 +306,10 @@ def list( """Lists all communications (attachments not included) for a support ticket. :code:`
`
You can also filter support ticket communications by *CreatedDate* or *CommunicationType* using the $filter parameter. The only type of communication supported today is *Web*. Output will be - a paged result with *nextLink*\ , using which you can retrieve the next set of Communication - results. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. + a paged result with *nextLink*\\ , using which you can retrieve the next set of Communication + results. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after + ticket creation. If a ticket was created more than 18 months ago, a request for data might + cause an error. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -332,7 +333,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -351,7 +352,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -367,7 +367,6 @@ def prepare_request(next_link=None): _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 @@ -409,7 +408,7 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -430,7 +429,6 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -445,7 +443,7 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -458,8 +456,8 @@ def _create_initial( communication_name: str, create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -472,7 +470,7 @@ def _create_initial( api_version: str = 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -492,10 +490,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -503,18 +501,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -618,10 +618,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_operations.py index f6ddfe767097..9af775585b42 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,31 +6,34 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +46,7 @@ def build_check_name_availability_request(support_ticket_name: str, subscription _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -51,7 +54,7 @@ def build_check_name_availability_request(support_ticket_name: str, subscription _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -81,14 +84,14 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -115,14 +118,14 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), @@ -146,7 +149,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -154,7 +157,7 @@ def build_create_request( _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), @@ -188,10 +191,10 @@ class CommunicationsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def check_name_availability( @@ -261,7 +264,7 @@ def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -294,7 +297,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -309,7 +311,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -323,10 +325,10 @@ def list( """Lists all communications (attachments not included) for a support ticket. :code:`
`
You can also filter support ticket communications by *CreatedDate* or *CommunicationType* using the $filter parameter. The only type of communication supported today is *Web*. Output will be - a paged result with *nextLink*\ , using which you can retrieve the next set of Communication - results. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. + a paged result with *nextLink*\\ , using which you can retrieve the next set of Communication + results. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after + ticket creation. If a ticket was created more than 18 months ago, a request for data might + cause an error. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -350,7 +352,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -370,7 +372,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -386,7 +387,6 @@ def prepare_request(next_link=None): _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 @@ -428,7 +428,7 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -450,7 +450,6 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -465,7 +464,7 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -478,8 +477,8 @@ def _create_initial( communication_name: str, create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -492,7 +491,7 @@ def _create_initial( api_version: str = 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -513,10 +512,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -524,13 +523,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -635,10 +636,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) + deserialized = self._deserialize("CommunicationDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_no_subscription_operations.py index 081010141e51..a88bc51b6199 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -17,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,7 +38,7 @@ def build_get_request(file_workspace_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -62,7 +62,7 @@ def build_create_request(file_workspace_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,10 +98,10 @@ class FileWorkspacesNoSubscriptionOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -113,7 +113,7 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -133,7 +133,6 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -148,7 +147,7 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -165,7 +164,7 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -185,7 +184,6 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -200,7 +198,7 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_operations.py index eb2e8bb39df3..e96c11c1d9a3 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +5,10 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Optional, TypeVar +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -17,15 +18,14 @@ map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -38,13 +38,13 @@ def build_get_request(file_workspace_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -65,13 +65,13 @@ def build_create_request(file_workspace_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "fileWorkspaceName": _SERIALIZER.url( "file_workspace_name", file_workspace_name, "str", pattern=r"^[0-9a-zA-Z_\-. ]+$" @@ -104,10 +104,10 @@ class FileWorkspacesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -119,7 +119,7 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -140,7 +140,6 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -155,7 +154,7 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -172,7 +171,7 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -193,7 +192,6 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -208,7 +206,7 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) + deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_no_subscription_operations.py index 30f3b465c88e..58444e8a8903 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -20,15 +21,14 @@ ) 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.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,7 +41,7 @@ def build_list_request(file_workspace_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -65,7 +65,7 @@ def build_get_request(file_workspace_name: str, file_name: str, **kwargs: Any) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -92,7 +92,7 @@ def build_create_request(file_workspace_name: str, file_name: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,14 +124,14 @@ def build_upload_request(file_workspace_name: str, file_name: str, **kwargs: Any _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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", "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), "fileName": _SERIALIZER.url("file_name", file_name, "str"), @@ -164,10 +164,10 @@ class FilesNoSubscriptionOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.FileDetails"]: @@ -185,7 +185,7 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.Fil api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FilesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -202,7 +202,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -218,7 +217,6 @@ def prepare_request(next_link=None): _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 @@ -260,7 +258,7 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -281,7 +279,6 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -296,7 +293,7 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -376,7 +373,7 @@ def create( :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -409,7 +406,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -424,7 +420,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -432,7 +428,7 @@ def create( return deserialized # type: ignore @overload - def upload( # pylint: disable=inconsistent-return-statements + def upload( self, file_workspace_name: str, file_name: str, @@ -458,7 +454,7 @@ def upload( # pylint: disable=inconsistent-return-statements """ @overload - def upload( # pylint: disable=inconsistent-return-statements + def upload( self, file_workspace_name: str, file_name: str, @@ -500,7 +496,7 @@ def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -533,7 +529,6 @@ def upload( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_operations.py index 491f9497fe59..505ca26b4755 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_operations.py @@ -1,4 +1,4 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,10 +6,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -20,15 +22,14 @@ ) 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.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -41,14 +42,14 @@ def build_list_request(file_workspace_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -69,14 +70,14 @@ def build_get_request(file_workspace_name: str, file_name: str, subscription_id: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), "fileName": _SERIALIZER.url("file_name", file_name, "str"), @@ -98,7 +99,7 @@ def build_create_request(file_workspace_name: str, file_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -106,7 +107,7 @@ def build_create_request(file_workspace_name: str, file_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "fileWorkspaceName": _SERIALIZER.url( "file_workspace_name", file_workspace_name, "str", pattern=r"^[0-9a-zA-Z_\-. ]+$" @@ -132,7 +133,7 @@ def build_upload_request(file_workspace_name: str, file_name: str, subscription_ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -140,7 +141,7 @@ def build_upload_request(file_workspace_name: str, file_name: str, subscription_ _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), "fileName": _SERIALIZER.url("file_name", file_name, "str"), @@ -174,10 +175,10 @@ class FilesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.FileDetails"]: @@ -195,7 +196,7 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.Fil api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FilesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -213,7 +214,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -229,7 +229,6 @@ def prepare_request(next_link=None): _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 @@ -271,7 +270,7 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -293,7 +292,6 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -308,7 +306,7 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -388,7 +386,7 @@ def create( :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -422,7 +420,6 @@ def create( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -437,7 +434,7 @@ def create( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("FileDetails", pipeline_response) + deserialized = self._deserialize("FileDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -445,7 +442,7 @@ def create( return deserialized # type: ignore @overload - def upload( # pylint: disable=inconsistent-return-statements + def upload( self, file_workspace_name: str, file_name: str, @@ -471,7 +468,7 @@ def upload( # pylint: disable=inconsistent-return-statements """ @overload - def upload( # pylint: disable=inconsistent-return-statements + def upload( self, file_workspace_name: str, file_name: str, @@ -513,7 +510,7 @@ def upload( # pylint: disable=inconsistent-return-statements :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -547,7 +544,6 @@ def upload( # pylint: disable=inconsistent-return-statements headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_look_up_resource_id_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_look_up_resource_id_operations.py new file mode 100644 index 000000000000..da5701a8f7ff --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_look_up_resource_id_operations.py @@ -0,0 +1,185 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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", "/providers/Microsoft.Support/lookUpResourceId") + + # 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class LookUpResourceIdOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.MicrosoftSupport`'s + :attr:`look_up_resource_id` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def post( + self, + look_up_resource_id_request: _models.LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """This operation fetches ARM resource id of support resource type. + + This operation fetches ARM resource id of support resource type. + + :param look_up_resource_id_request: Look up resource id request body. Required. + :type look_up_resource_id_request: ~azure.mgmt.support.models.LookUpResourceIdRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: LookUpResourceIdResponse or the result of cls(response) + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( + self, look_up_resource_id_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """This operation fetches ARM resource id of support resource type. + + This operation fetches ARM resource id of support resource type. + + :param look_up_resource_id_request: Look up resource id request body. Required. + :type look_up_resource_id_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: LookUpResourceIdResponse or the result of cls(response) + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( + self, look_up_resource_id_request: Union[_models.LookUpResourceIdRequest, IO[bytes]], **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """This operation fetches ARM resource id of support resource type. + + This operation fetches ARM resource id of support resource type. + + :param look_up_resource_id_request: Look up resource id request body. Is either a + LookUpResourceIdRequest type or a IO[bytes] type. Required. + :type look_up_resource_id_request: ~azure.mgmt.support.models.LookUpResourceIdRequest or + IO[bytes] + :return: LookUpResourceIdResponse or the result of cls(response) + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.LookUpResourceIdResponse] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(look_up_resource_id_request, (IOBase, bytes)): + _content = look_up_resource_id_request + else: + _json = self._serialize.body(look_up_resource_id_request, "LookUpResourceIdRequest") + + _request = build_post_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("LookUpResourceIdResponse", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_operations.py index 864083b878b6..5e5883bb5bdc 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,15 +20,14 @@ ) 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.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,10 +69,10 @@ class Operations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: @@ -88,7 +88,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -104,7 +104,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -120,7 +119,6 @@ def prepare_request(next_link=None): _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 diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_no_subscription_operations.py new file mode 100644 index 000000000000..fdb4ffd28c52 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_no_subscription_operations.py @@ -0,0 +1,210 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_classify_problems_request(problem_service_name: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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", "/providers/Microsoft.Support/services/{problemServiceName}/classifyProblems") + path_format_arguments = { + "problemServiceName": _SERIALIZER.url( + "problem_service_name", problem_service_name, "str", pattern=r"^[0-9a-zA-Z_\-. ]+$" + ), + } + + _url: str = _url.format(**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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ProblemClassificationsNoSubscriptionOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.MicrosoftSupport`'s + :attr:`problem_classifications_no_subscription` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, IO[bytes] + ], + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Is either a + ProblemClassificationsClassificationInput type or a IO[bytes] type. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ProblemClassificationsClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _json = self._serialize.body( + problem_classifications_classification_input, "ProblemClassificationsClassificationInput" + ) + + _request = build_classify_problems_request( + problem_service_name=problem_service_name, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ProblemClassificationsClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_operations.py index d161a05a612d..e7905949f20c 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,12 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,15 +21,14 @@ ) 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.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -36,11 +37,44 @@ _SERIALIZER.client_side_validation = False +def build_classify_problems_request(problem_service_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: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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}/providers/Microsoft.Support/services/{problemServiceName}/classifyProblems", + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "problemServiceName": _SERIALIZER.url( + "problem_service_name", problem_service_name, "str", pattern=r"^[0-9a-zA-Z_\-. ]+$" + ), + } + + _url: str = _url.format(**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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + def build_list_request(service_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,14 +98,14 @@ def build_get_request(service_name: str, problem_classification_name: str, **kwa _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}", - ) # pylint: disable=line-too-long + ) path_format_arguments = { "serviceName": _SERIALIZER.url("service_name", service_name, "str"), "problemClassificationName": _SERIALIZER.url("problem_classification_name", problem_classification_name, "str"), @@ -102,10 +136,137 @@ class ProblemClassificationsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, IO[bytes] + ], + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Is either a + ProblemClassificationsClassificationInput type or a IO[bytes] type. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ProblemClassificationsClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _json = self._serialize.body( + problem_classifications_classification_input, "ProblemClassificationsClassificationInput" + ) + + _request = build_classify_problems_request( + problem_service_name=problem_service_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ProblemClassificationsClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore @distributed_trace def list(self, service_name: str, **kwargs: Any) -> Iterable["_models.ProblemClassification"]: @@ -127,7 +288,7 @@ def list(self, service_name: str, **kwargs: Any) -> Iterable["_models.ProblemCla api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProblemClassificationsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -144,7 +305,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -160,7 +320,6 @@ def prepare_request(next_link=None): _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 @@ -194,7 +353,8 @@ def get_next(next_link=None): def get(self, service_name: str, problem_classification_name: str, **kwargs: Any) -> _models.ProblemClassification: """Get problem classification details for a specific Azure service. - :param service_name: Name of the Azure service available for support. Required. + :param service_name: Name of the Azure service for which the problem classifications need to be + retrieved. Required. :type service_name: str :param problem_classification_name: Name of problem classification. Required. :type problem_classification_name: str @@ -202,7 +362,7 @@ def get(self, service_name: str, problem_classification_name: str, **kwargs: Any :rtype: ~azure.mgmt.support.models.ProblemClassification :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -223,7 +383,6 @@ def get(self, service_name: str, problem_classification_name: str, **kwargs: Any headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -238,7 +397,7 @@ def get(self, service_name: str, problem_classification_name: str, **kwargs: Any error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("ProblemClassification", pipeline_response) + deserialized = self._deserialize("ProblemClassification", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_no_subscription_operations.py new file mode 100644 index 000000000000..4848f5af4fc8 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_no_subscription_operations.py @@ -0,0 +1,179 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_classify_services_request(**kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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", "/providers/Microsoft.Support/classifyServices") + + # 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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ServiceClassificationsNoSubscriptionOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.MicrosoftSupport`'s + :attr:`service_classifications_no_subscription` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_services( + self, service_classification_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def classify_services( + self, service_classification_request: Union[_models.ServiceClassificationRequest, IO[bytes]], **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Is either a ServiceClassificationRequest + type or a IO[bytes] type. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + or IO[bytes] + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ServiceClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _json = self._serialize.body(service_classification_request, "ServiceClassificationRequest") + + _request = build_classify_services_request( + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ServiceClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_operations.py new file mode 100644 index 000000000000..fcce997b29c6 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_operations.py @@ -0,0 +1,185 @@ +# 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 collections.abc import MutableMapping +from io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core import PipelineClient +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +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 .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer + +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_classify_services_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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}/providers/Microsoft.Support/classifyServices") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**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="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ServiceClassificationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.MicrosoftSupport`'s + :attr:`service_classifications` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_services( + self, service_classification_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def classify_services( + self, service_classification_request: Union[_models.ServiceClassificationRequest, IO[bytes]], **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Is either a ServiceClassificationRequest + type or a IO[bytes] type. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + or IO[bytes] + :return: ServiceClassificationOutput or the result of cls(response) + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 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: str = 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.ServiceClassificationOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _json = self._serialize.body(service_classification_request, "ServiceClassificationRequest") + + _request = build_classify_services_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _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("ServiceClassificationOutput", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_services_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_services_operations.py index c1d983161a37..132b17ddda5e 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_services_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_services_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,9 +5,11 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from typing import Any, Callable, Dict, Iterable, Optional, TypeVar import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,15 +20,14 @@ ) 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.rest import HttpRequest, HttpResponse 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 +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -40,7 +40,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -59,7 +59,7 @@ def build_get_request(service_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -93,10 +93,10 @@ class ServicesOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Service"]: @@ -118,7 +118,7 @@ def list(self, **kwargs: Any) -> Iterable["_models.Service"]: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ServicesListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -134,7 +134,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -150,7 +149,6 @@ def prepare_request(next_link=None): _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 @@ -184,13 +182,14 @@ def get_next(next_link=None): def get(self, service_name: str, **kwargs: Any) -> _models.Service: """Gets a specific Azure service for support ticket creation. - :param service_name: Name of the Azure service. Required. + :param service_name: Name of the Azure service for which the problem classifications need to be + retrieved. Required. :type service_name: str :return: Service or the result of cls(response) :rtype: ~azure.mgmt.support.models.Service :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -210,7 +209,6 @@ def get(self, service_name: str, **kwargs: Any) -> _models.Service: headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -225,7 +223,7 @@ def get(self, service_name: str, **kwargs: Any) -> _models.Service: error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("Service", pipeline_response) + deserialized = self._deserialize("Service", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_no_subscription_operations.py index f69e8ea51c78..13e804564761 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_no_subscription_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_no_subscription_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,31 +5,34 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +45,7 @@ def build_check_name_availability_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -65,7 +67,7 @@ def build_list_request(*, top: Optional[int] = None, filter: Optional[str] = Non _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -88,7 +90,7 @@ def build_get_request(support_ticket_name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -112,7 +114,7 @@ def build_update_request(support_ticket_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -139,7 +141,7 @@ def build_create_request(support_ticket_name: str, **kwargs: Any) -> HttpRequest _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -176,10 +178,10 @@ class SupportTicketsNoSubscriptionOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def check_name_availability( @@ -234,7 +236,7 @@ def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -265,7 +267,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -280,7 +281,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -291,13 +292,13 @@ def check_name_availability( def list( self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.SupportTicketDetails"]: - """Lists all the support tickets. :code:`
`:code:`
`You can also filter the support + """Lists all the support tickets. :code:`
`\\ :code:`
`You can also filter the support tickets by :code:`Status`, :code:`CreatedDate`, , :code:`ServiceId`, and :code:`ProblemClassificationId` using the $filter parameter. Output will be a paged result with :code:`nextLink`, using which you can retrieve the next set of support - tickets. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. + tickets. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after + ticket creation. If a ticket was created more than 18 months ago, a request for data might + cause an error. :param top: The number of values to return in the collection. Default is 25 and max is 100. Default value is None. @@ -305,7 +306,7 @@ def list( :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. :code:`Learn more` - :code:`
`:code:`Status` , :code:`ServiceId`, and + :code:`
`\\ :code:`Status` , :code:`ServiceId`, and :code:`ProblemClassificationId` filters can only be used with 'eq' operator. For :code:`CreatedDate` filter, the supported operators are 'gt' and 'ge'. When using both filters, combine them using the logical 'AND'. Default value is None. @@ -321,7 +322,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -339,7 +340,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -355,7 +355,6 @@ def prepare_request(next_link=None): _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 @@ -397,7 +396,7 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -417,7 +416,6 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -432,7 +430,7 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -449,10 +447,10 @@ def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. + in the support ticket.\\ :code:`
`\\ :code:`
`Note: The severity levels cannot be + changed if a support ticket is actively being worked upon by an Azure support engineer. In such + a case, contact your support engineer to request severity update by adding a new communication + using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -476,10 +474,10 @@ def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. + in the support ticket.\\ :code:`
`\\ :code:`
`Note: The severity levels cannot be + changed if a support ticket is actively being worked upon by an Azure support engineer. In such + a case, contact your support engineer to request severity update by adding a new communication + using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -501,10 +499,10 @@ def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. + in the support ticket.\\ :code:`
`\\ :code:`
`Note: The severity levels cannot be + changed if a support ticket is actively being worked upon by an Azure support engineer. In such + a case, contact your support engineer to request severity update by adding a new communication + using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -515,7 +513,7 @@ def update( :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -547,7 +545,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -562,7 +559,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -574,8 +571,8 @@ def _create_initial( support_ticket_name: str, create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -588,7 +585,7 @@ def _create_initial( api_version: str = 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -607,10 +604,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -618,18 +615,20 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - if response.status_code == 202: response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + if cls: return cls(pipeline_response, deserialized, response_headers) # type: ignore @@ -645,17 +644,17 @@ def begin_create( **kwargs: Any ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `prerequisites `_ required to create a support ticket.\\ + :code:`
`\\ :code:`
`Always call the Services and ProblemClassifications API to get the + most recent set of services and problem categories required for support ticket creation.\\ + :code:`
`\\ :code:`
`Adding attachments is not currently supported via the API. To add + a file to an existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -680,17 +679,17 @@ def begin_create( **kwargs: Any ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `prerequisites `_ required to create a support ticket.\\ + :code:`
`\\ :code:`
`Always call the Services and ProblemClassifications API to get the + most recent set of services and problem categories required for support ticket creation.\\ + :code:`
`\\ :code:`
`Adding attachments is not currently supported via the API. To add + a file to an existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -713,17 +712,17 @@ def begin_create( **kwargs: Any ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `prerequisites `_ required to create a support ticket.\\ + :code:`
`\\ :code:`
`Always call the Services and ProblemClassifications API to get the + most recent set of services and problem categories required for support ticket creation.\\ + :code:`
`\\ :code:`
`Adding attachments is not currently supported via the API. To add + a file to an existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -756,10 +755,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_operations.py index 9a9c95f7a740..e5043bec5f69 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_operations.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_operations.py @@ -1,4 +1,3 @@ -# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,31 +5,34 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from collections.abc import MutableMapping from io import IOBase -from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .._configuration import MicrosoftSupportConfiguration +from .._serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] @@ -43,7 +45,7 @@ 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: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -74,7 +76,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,13 +104,13 @@ def build_get_request(support_ticket_name: str, subscription_id: str, **kwargs: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL _url = kwargs.pop( "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -129,14 +131,14 @@ def build_update_request(support_ticket_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -159,14 +161,14 @@ def build_create_request(support_ticket_name: str, subscription_id: str, **kwarg _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-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}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - ) # pylint: disable=line-too-long + ) path_format_arguments = { "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), @@ -199,10 +201,10 @@ class SupportTicketsOperations: 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") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MicrosoftSupportConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @overload def check_name_availability( @@ -257,7 +259,7 @@ def check_name_availability( :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -289,7 +291,6 @@ def check_name_availability( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -304,7 +305,7 @@ def check_name_availability( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) + deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -316,9 +317,9 @@ def list( self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.SupportTicketDetails"]: """Lists all the support tickets for an Azure subscription. You can also filter the support - tickets by *Status*\ , *CreatedDate*\ , *ServiceId*\ , and *ProblemClassificationId* using the - $filter parameter. Output will be a paged result with *nextLink*\ , using which you can - retrieve the next set of support tickets. :code:`
`:code:`
`Support ticket data is + tickets by *Status*\\ , *CreatedDate*\\ , *ServiceId*\\ , and *ProblemClassificationId* using + the $filter parameter. Output will be a paged result with *nextLink*\\ , using which you can + retrieve the next set of support tickets. :code:`
`\\ :code:`
`Support ticket data is available for 18 months after ticket creation. If a ticket was created more than 18 months ago, a request for data might cause an error. @@ -326,8 +327,8 @@ def list( Default value is None. :type top: int :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. - `Learn more `_. *Status*\ , - *ServiceId*\ , and *ProblemClassificationId* filters can only be used with Equals ('eq') + `Learn more `_. *Status*\\ , + *ServiceId*\\ , and *ProblemClassificationId* filters can only be used with Equals ('eq') operator. For *CreatedDate* filter, the supported operators are Greater Than ('gt') and Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. Default value is None. @@ -343,7 +344,7 @@ def list( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketsListResult] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -362,7 +363,6 @@ def prepare_request(next_link=None): headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) else: @@ -378,7 +378,6 @@ def prepare_request(next_link=None): _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 @@ -420,7 +419,7 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -441,7 +440,6 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -456,7 +454,7 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -473,10 +471,10 @@ def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. + and your contact information in the support ticket.\\ :code:`
`\\ :code:`
`Note: The + severity levels cannot be changed if a support ticket is actively being worked upon by an Azure + support engineer. In such a case, contact your support engineer to request severity update by + adding a new communication using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -500,10 +498,10 @@ def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. + and your contact information in the support ticket.\\ :code:`
`\\ :code:`
`Note: The + severity levels cannot be changed if a support ticket is actively being worked upon by an Azure + support engineer. In such a case, contact your support engineer to request severity update by + adding a new communication using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -525,10 +523,10 @@ def update( **kwargs: Any ) -> _models.SupportTicketDetails: """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. + and your contact information in the support ticket.\\ :code:`
`\\ :code:`
`Note: The + severity levels cannot be changed if a support ticket is actively being worked upon by an Azure + support engineer. In such a case, contact your support engineer to request severity update by + adding a new communication using the Communications API. :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str @@ -539,7 +537,7 @@ def update( :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: """ - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -572,7 +570,6 @@ def update( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) _stream = False @@ -587,7 +584,7 @@ def update( error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -599,8 +596,8 @@ def _create_initial( support_ticket_name: str, create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - error_map = { + ) -> Iterator[bytes]: + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -613,7 +610,7 @@ def _create_initial( api_version: str = 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None @@ -633,10 +630,10 @@ def _create_initial( headers=_headers, params=_params, ) - _request = _convert_request(_request) _request.url = self._client.format_url(_request.url) - _stream = False + _decompress = kwargs.pop("decompress", True) + _stream = True pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -644,13 +641,15 @@ def _create_initial( response = pipeline_response.http_response if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass 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 = None - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore @@ -668,19 +667,19 @@ def begin_create( ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `_ required to create a support ticket.\\ :code:`
`\\ + :code:`
`Always call the Services and ProblemClassifications API to get the most recent set + of services and problem categories required for support ticket creation.\\ :code:`
`\\ + :code:`
`Adding attachments is not currently supported via the API. To add a file to an + existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`\\ **Creating a support + ticket for on-behalf-of**\\ : Include *x-ms-authorization-auxiliary* header to provide an + auxiliary token as per `documentation `_. The primary token will be from the tenant for whom a support ticket is being raised against the subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be @@ -710,19 +709,19 @@ def begin_create( ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `_ required to create a support ticket.\\ :code:`
`\\ + :code:`
`Always call the Services and ProblemClassifications API to get the most recent set + of services and problem categories required for support ticket creation.\\ :code:`
`\\ + :code:`
`Adding attachments is not currently supported via the API. To add a file to an + existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`\\ **Creating a support + ticket for on-behalf-of**\\ : Include *x-ms-authorization-auxiliary* header to provide an + auxiliary token as per `documentation `_. The primary token will be from the tenant for whom a support ticket is being raised against the subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be @@ -750,19 +749,19 @@ def begin_create( ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket + `_ required to create a support ticket.\\ :code:`
`\\ + :code:`
`Always call the Services and ProblemClassifications API to get the most recent set + of services and problem categories required for support ticket creation.\\ :code:`
`\\ + :code:`
`Adding attachments is not currently supported via the API. To add a file to an + existing support ticket, visit the `Manage support ticket `_ page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation + new file.\\ :code:`
`\\ :code:`
`Providing consent to share diagnostic information with + Azure support is currently not supported via the API. The Azure support engineer working on + your ticket will reach out to you for consent if your issue requires gathering diagnostic + information from your Azure resources.\\ :code:`
`\\ :code:`
`\\ **Creating a support + ticket for on-behalf-of**\\ : Include *x-ms-authorization-auxiliary* header to provide an + auxiliary token as per `documentation `_. The primary token will be from the tenant for whom a support ticket is being raised against the subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be @@ -799,10 +798,11 @@ def begin_create( params=_params, **kwargs ) + raw_result.http_response.read() # type: ignore kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) + deserialized = self._deserialize("SupportTicketDetails", pipeline_response.http_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability.py index f83f10a7b1d8..de00f5544321 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability.py +++ b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailability.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_no_subscription_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_no_subscription_support_ticket_communication.py index 8a49408f5129..90f43e5d72e8 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_no_subscription_support_ticket_communication.py +++ b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_no_subscription_support_ticket_communication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailabilityForNoSubscriptionSupportTicketCommunication.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CheckNameAvailabilityForNoSubscriptionSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_support_ticket_communication.py index 1432722ef48e..7c0e99029d9c 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_support_ticket_communication.py +++ b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_support_ticket_communication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.communications.check_name_availability( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailabilityForSupportTicketCommunication.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CheckNameAvailabilityForSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_with_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_with_subscription.py index e4e782b75da0..6d80b947b942 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_with_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_with_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.check_name_availability( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailabilityWithSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CheckNameAvailabilityWithSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications.py b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications.py new file mode 100644 index 000000000000..dcdf45ae1d35 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications.py @@ -0,0 +1,43 @@ +# pylint: disable=line-too-long,useless-suppression +# 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.support import MicrosoftSupport + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-support +# USAGE + python classify_problem_classifications.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 = MicrosoftSupport( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.problem_classifications_no_subscription.classify_problems( + problem_service_name="serviceId1", + problem_classifications_classification_input={"issueSummary": "Can not connect to Windows VM"}, + ) + print(response) + + +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ClassifyProblemClassifications.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications_for_subscription.py new file mode 100644 index 000000000000..0baf02f1fcab --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications_for_subscription.py @@ -0,0 +1,46 @@ +# pylint: disable=line-too-long,useless-suppression +# 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.support import MicrosoftSupport + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-support +# USAGE + python classify_problem_classifications_for_subscription.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 = MicrosoftSupport( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.problem_classifications.classify_problems( + problem_service_name="serviceId1", + problem_classifications_classification_input={ + "issueSummary": "Can not connect to Windows VM", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/vmname", + }, + ) + print(response) + + +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ClassifyProblemClassificationsForSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/classify_services.py b/sdk/support/azure-mgmt-support/generated_samples/classify_services.py new file mode 100644 index 000000000000..ae4ef1927955 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_services.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# 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.support import MicrosoftSupport + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-support +# USAGE + python classify_services.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 = MicrosoftSupport( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.service_classifications_no_subscription.classify_services( + service_classification_request={ + "issueSummary": "Can not connect to Windows VM", + "resourceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/vmname", + }, + ) + print(response) + + +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ClassifyServices.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/classify_services_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/classify_services_for_subscription.py new file mode 100644 index 000000000000..68e2441b5b70 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_services_for_subscription.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# 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.support import MicrosoftSupport + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-support +# USAGE + python classify_services_for_subscription.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 = MicrosoftSupport( + credential=DefaultAzureCredential(), + subscription_id="00000000-0000-0000-0000-000000000000", + ) + + response = client.service_classifications.classify_services( + service_classification_request={ + "issueSummary": "Can not connect to Windows VM", + "resourceId": "/subscriptions/76cb77fa-8b17-4eab-9493-b65dace99813/resourceGroups/rgname/providers/Microsoft.Compute/virtualMachines/vmname", + }, + ) + print(response) + + +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ClassifyServicesForSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py index 201ec42c20c2..8e92880e6ea1 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForActiveJobs.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForActiveJobs.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py index e25dd7ab55d1..6d1b4c1a769e 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -68,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForDedicatedCores.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForDedicatedCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py index 1c78299a0f90..6c378a49d3ef 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForLowPriorityCores.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForLowPriorityCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py index d97968923e63..c52ff63978e9 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForPools.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateBatchQuotaTicketForSpecificBatchAccountForPools.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py index 5da11c666290..e6e008f28b2f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateBatchQuotaTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py index 7facd9c7bb39..1dd68191214c 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -36,7 +35,6 @@ def main(): support_ticket_name="testticket", create_support_ticket_parameters={ "properties": { - "advancedDiagnosticConsent": "No", "contactDetails": { "country": "usa", "firstName": "abc", @@ -59,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBillingSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateBillingSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py index 609ede7789b3..06ce7e377d45 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,14 +28,13 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( support_ticket_name="testticket", create_support_ticket_parameters={ "properties": { - "advancedDiagnosticConsent": "No", "contactDetails": { "country": "usa", "firstName": "abc", @@ -59,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBillingSupportTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateBillingSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py index 77b4a9ae699a..bf87d34b5d55 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -62,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateCoresQuotaTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateCoresQuotaTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file.py b/sdk/support/azure-mgmt-support/generated_samples/create_file.py index ec7bf878433d..848d378904ee 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_file.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_file.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFile.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateFile.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_file_for_subscription.py index 237aff1173db..7fc8accd2c79 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_file_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_file_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.files.create( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFileForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateFileForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace.py b/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace.py index 3f8422e93f00..5d9946d33e06 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFileWorkspace.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateFileWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace_for_subscription.py index 7be82e339382..3772df56d1d0 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.file_workspaces.create( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFileWorkspaceForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateFileWorkspaceForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py index d314e0c6ae2a..f1d43b4f5fc1 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,14 +28,13 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( support_ticket_name="testticket", create_support_ticket_parameters={ "properties": { - "advancedDiagnosticConsent": "Yes", "contactDetails": { "country": "usa", "firstName": "abc", @@ -57,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateGenericQuotaTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateGenericQuotaTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py index f95080a3c51f..bc6669618740 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -68,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateMachineLearningQuotaTicketForDedicatedCores.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateMachineLearningQuotaTicketForDedicatedCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py index 44ff700028a5..fde5d786ff3e 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateMachineLearningQuotaTicketForLowPriorityCores.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateMachineLearningQuotaTicketForLowPriorityCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_no_subscription_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/create_no_subscription_support_ticket_communication.py index eef2a18f6d3c..583d969f52fb 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_no_subscription_support_ticket_communication.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_no_subscription_support_ticket_communication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateNoSubscriptionSupportTicketCommunication.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateNoSubscriptionSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py index 32099f323ad9..6d6d596c82e0 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatabaseQuotaTicketForDTUs.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSqlDatabaseQuotaTicketForDTUs.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py index cca555c98d93..6be20f919280 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatabaseQuotaTicketForServers.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSqlDatabaseQuotaTicketForServers.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py index 1fc44e2e28f9..ebdd5c79cb8f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatawarehouseQuotaTicketForDTUs.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSqlDatawarehouseQuotaTicketForDTUs.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py index 9c2f40077aef..a07d6f133902 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatawarehouseQuotaTicketForServers.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSqlDatawarehouseQuotaTicketForServers.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py index e1ac8f328ab2..8fd6691ee6e8 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -66,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlManagedInstanceQuotaTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSqlManagedInstanceQuotaTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py index 1bbad7128cd0..df39c72a0b47 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -36,7 +35,6 @@ def main(): support_ticket_name="testticket", create_support_ticket_parameters={ "properties": { - "advancedDiagnosticConsent": "Yes", "contactDetails": { "country": "usa", "firstName": "abc", @@ -59,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSubMgmtSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSubMgmtSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py index 25cd5acf9a91..7e0122541d3b 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,14 +28,13 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( support_ticket_name="testticket", create_support_ticket_parameters={ "properties": { - "advancedDiagnosticConsent": "No", "contactDetails": { "country": "usa", "firstName": "abc", @@ -59,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSubMgmtSupportTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSubMgmtSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/create_support_ticket_communication.py index 11e6b079c8b5..8b9c6304e431 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_support_ticket_communication.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_support_ticket_communication.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.communications.begin_create( @@ -46,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSupportTicketCommunication.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py index 70d7f416840b..3c859aaf9c06 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -61,6 +60,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateTechnicalSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateTechnicalSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py index 0b292dbf0f94..2e96931691c7 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.begin_create( @@ -55,7 +54,7 @@ def main(): "severity": "moderate", "supportPlanId": "U291cmNlOlNDTSxDbGFyaWZ5SW5zdGFsbGF0aW9uU2l0ZUlkOjcsTGluZUl0ZW1JZDo5ODY1NzIyOSxDb250cmFjdElkOjk4NjU5MTk0LFN1YnNjcmlwdGlvbklkOjc2Y2I3N2ZhLThiMTctNGVhYi05NDkzLWI2NWRhY2U5OTgxMyw=", "technicalTicketDetails": { - "resourceId": "/subscriptions/132d901f-189d-4381-9214-fe68e27e05a1/resourceGroups/test/providers/Microsoft.Compute/virtualMachines/testserver" + "resourceId": "/subscriptions/subid/resourceGroups/test/providers/Microsoft.Compute/virtualMachines/testserver" }, "title": "my title", } @@ -64,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateTechnicalSupportTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/CreateTechnicalSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_subscription_support_ticket.py index e1bcfbb4d638..eed57605602f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_subscription_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_subscription_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.communications.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetCommunicationDetailsForSubscriptionSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetCommunicationDetailsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_support_ticket.py index e2ff54027f82..5840fa400c06 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetCommunicationDetailsForSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetCommunicationDetailsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_details.py index 155d96f6d149..0a7dbb0818c5 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_file_details.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_file_details.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileDetails.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetFileDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_details_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_details_for_subscription.py index b5f74a3a28d0..1bd22c920781 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_file_details_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_file_details_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.files.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileDetailsForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetFileDetailsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details.py index 9c9880bea433..2263d6486d05 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileWorkspaceDetails.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetFileWorkspaceDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details_for_subscription.py index 7254994d8c16..54a22d89dcf7 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.file_workspaces.get( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileWorkspaceDetailsForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetFileWorkspaceDetailsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_problem_classification.py b/sdk/support/azure-mgmt-support/generated_samples/get_problem_classification.py index d985362e96b8..5c6dcdae61c9 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_problem_classification.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_problem_classification.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetProblemClassification.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetProblemClassification.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_service.py b/sdk/support/azure-mgmt-support/generated_samples/get_service.py index 6afa7e4fe239..bcd9a0aefce4 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_service.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_service.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetService.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetService.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_subscription_support_ticket_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_subscription_support_ticket_details.py index 75629c95895d..5db1346adf41 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_subscription_support_ticket_details.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_subscription_support_ticket_details.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.get( @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetSubscriptionSupportTicketDetails.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetSubscriptionSupportTicketDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_support_ticket_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_support_ticket_details.py index 2a25fee7c9e2..0040a467e745 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_support_ticket_details.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_support_ticket_details.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetSupportTicketDetails.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetSupportTicketDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_subscription_support_ticket.py index f82f6f92bcaa..eaf09a2b092e 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_subscription_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_subscription_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.chat_transcripts.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetchatTranscriptDetailsForSubscriptionSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetchatTranscriptDetailsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_support_ticket.py index 8f6a6f4a9595..60d6eedbf670 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="SUBSCRIPTION_ID", + subscription_id="subid", ) response = client.chat_transcripts_no_subscription.get( @@ -37,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetchatTranscriptDetailsForSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/GetchatTranscriptDetailsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_subscription_support_ticket.py index 845f4567160e..6dcf00562091 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_subscription_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_subscription_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.chat_transcripts.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListChatTranscriptsForSubscriptionSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListChatTranscriptsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_support_ticket.py index 984b21292d76..767d24ad9745 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListChatTranscriptsForSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListChatTranscriptsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_subscription_support_ticket.py index b8fda155d9d3..d23bc6136ada 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_subscription_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_subscription_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.communications.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListCommunicationsForSubscriptionSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListCommunicationsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_support_ticket.py index d60c87b5b8b0..aa9191311351 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListCommunicationsForSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListCommunicationsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_files_for_subscription_under_file_workspace.py b/sdk/support/azure-mgmt-support/generated_samples/list_files_for_subscription_under_file_workspace.py index 99638db9ea9a..c7997290c2b2 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_files_for_subscription_under_file_workspace.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_files_for_subscription_under_file_workspace.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.files.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListFilesForSubscriptionUnderFileWorkspace.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListFilesForSubscriptionUnderFileWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_files_under_file_workspace.py b/sdk/support/azure-mgmt-support/generated_samples/list_files_under_file_workspace.py index afe2c8209c09..62d87563e09c 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_files_under_file_workspace.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_files_under_file_workspace.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListFilesUnderFileWorkspace.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListFilesUnderFileWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_operations.py b/sdk/support/azure-mgmt-support/generated_samples/list_operations.py index 8a26c2b5b440..62e0d913b737 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_operations.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListOperations.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_problem_classifications.py b/sdk/support/azure-mgmt-support/generated_samples/list_problem_classifications.py index fe8104b96f53..619fde273f76 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_problem_classifications.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_problem_classifications.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListProblemClassifications.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListProblemClassifications.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_services.py b/sdk/support/azure-mgmt-support/generated_samples/list_services.py index 5c29dc1036a5..b73563c5f14d 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_services.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_services.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListServices.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListServices.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets.py index 5402342c9711..ede2660aac64 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTickets.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTickets.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_by_subscription.py index 50caa59cf10a..f8867668c7bf 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_by_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsBySubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state.py index 8f5eac42a009..23ce32bc0254 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenState.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state_by_subscription.py index 37be084c986e..0fbebb7f9d94 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state_by_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenStateBySubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state.py index a87c84812596..f864024bbb2b 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingState.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state_by_subscription.py index 806c49721ef1..b704e8d8ea7f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state_by_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingStateBySubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state.py index bd2e98cfcd66..e0d3ea634084 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInOpenState.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsInOpenState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state_by_subscription.py index b3207763d547..eb9bc248ad80 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state_by_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInOpenStateBySubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsInOpenStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state.py index e603fe049a8b..a5cc61889d7d 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInUpdatingState.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsInUpdatingState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state_by_subscription.py index c6d5a5748964..f99bb5f2e9dd 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state_by_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state_by_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInUpdatingStateBySubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsInUpdatingStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals.py index 58e993d343cc..02a2fad99422 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsProblemClassificationIdEquals.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsProblemClassificationIdEquals.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals_for_subscription.py index d78bf90a4b28..fe68fe6c650e 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsProblemClassificationIdEqualsForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsProblemClassificationIdEqualsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals.py index e76f01a79290..6261e9d6367c 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsServiceIdEquals.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsServiceIdEquals.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals_for_subscription.py index d724f34b0873..e7bd0dc05cb2 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.list() @@ -35,6 +36,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsServiceIdEqualsForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListSupportTicketsServiceIdEqualsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket.py index 2d5d9bfe6584..0c6315c22ce8 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.communications.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSubscriptionSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListWebCommunicationsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket_created_on_or_after.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket_created_on_or_after.py index a2401aecb337..3d6323e9f781 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket_created_on_or_after.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket_created_on_or_after.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -27,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.communications.list( @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSubscriptionSupportTicketCreatedOnOrAfter.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListWebCommunicationsForSubscriptionSupportTicketCreatedOnOrAfter.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket.py index 4f292da979d3..98632d54e04f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListWebCommunicationsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket_created_on_or_after.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket_created_on_or_after.py index 4f8f563d813f..0e8d66806bc2 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket_created_on_or_after.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket_created_on_or_after.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -37,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSupportTicketCreatedOnOrAfter.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/ListWebCommunicationsForSupportTicketCreatedOnOrAfter.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/look_up_resource_id.py b/sdk/support/azure-mgmt-support/generated_samples/look_up_resource_id.py new file mode 100644 index 000000000000..6aed1ffc2b57 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/look_up_resource_id.py @@ -0,0 +1,42 @@ +# pylint: disable=line-too-long,useless-suppression +# 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.support import MicrosoftSupport + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-support +# USAGE + python look_up_resource_id.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 = MicrosoftSupport( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.look_up_resource_id.post( + look_up_resource_id_request={"identifier": "1234668596", "type": "Microsoft.Support/supportTickets"}, + ) + print(response) + + +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/LookUpResourceId.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket.py index fe4b106632a4..16bc47a7ece3 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateAdvancedDiagnosticConsentOfSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateAdvancedDiagnosticConsentOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket_for_subscription.py index e84af5fcb6cb..effcbb3bbe6f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateAdvancedDiagnosticConsentOfSupportTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateAdvancedDiagnosticConsentOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket.py index 90508f2e6a43..928731f45034 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -51,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateContactDetailsOfSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateContactDetailsOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket_for_subscription.py index 21c6ddc77e3b..ba58c5aab405 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.update( @@ -51,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateContactDetailsOfSupportTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateContactDetailsOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket.py index 8108586a8a95..3e024ae2feef 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateSeverityOfSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateSeverityOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket_for_subscription.py index 1afd4d1cc000..a1f936680e01 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateSeverityOfSupportTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateSeverityOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket.py index 211d1650c782..78f393c149d0 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateStatusOfSupportTicket.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateStatusOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket_for_subscription.py index d5d5b8b28307..cafd97748f2f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) response = client.support_tickets.update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateStatusOfSupportTicketForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UpdateStatusOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/upload_file.py b/sdk/support/azure-mgmt-support/generated_samples/upload_file.py index d5feaadbf452..f675aa81f7ef 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/upload_file.py +++ b/sdk/support/azure-mgmt-support/generated_samples/upload_file.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) client.files_no_subscription.upload( @@ -42,6 +41,6 @@ def main(): ) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UploadFile.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UploadFile.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py index b01005c228b6..53b8ecb0723e 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +7,6 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, IO, Union - from azure.identity import DefaultAzureCredential from azure.mgmt.support import MicrosoftSupport @@ -29,7 +28,7 @@ def main(): client = MicrosoftSupport( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="subid", ) client.files.upload( @@ -42,6 +41,6 @@ def main(): ) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UploadFileForSubscription.json +# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2023-06-01-preview/examples/UploadFileForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_tests/conftest.py b/sdk/support/azure-mgmt-support/generated_tests/conftest.py new file mode 100644 index 000000000000..382ee5ea447f --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# 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 os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + microsoftsupport_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + microsoftsupport_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + microsoftsupport_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + microsoftsupport_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=microsoftsupport_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=microsoftsupport_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=microsoftsupport_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=microsoftsupport_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_no_subscription_operations.py new file mode 100644 index 000000000000..4593aa7628e9 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_no_subscription_operations.py @@ -0,0 +1,42 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportChatTranscriptsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_no_subscription_list(self, resource_group): + response = self.client.chat_transcripts_no_subscription.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_no_subscription_get(self, resource_group): + response = self.client.chat_transcripts_no_subscription.get( + support_ticket_name="str", + chat_transcript_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_no_subscription_operations_async.py new file mode 100644 index 000000000000..f37ce60b9727 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_no_subscription_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportChatTranscriptsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_no_subscription_list(self, resource_group): + response = self.client.chat_transcripts_no_subscription.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_no_subscription_get(self, resource_group): + response = await self.client.chat_transcripts_no_subscription.get( + support_ticket_name="str", + chat_transcript_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_operations.py new file mode 100644 index 000000000000..844028db0f06 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_operations.py @@ -0,0 +1,42 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportChatTranscriptsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_list(self, resource_group): + response = self.client.chat_transcripts.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_get(self, resource_group): + response = self.client.chat_transcripts.get( + support_ticket_name="str", + chat_transcript_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_operations_async.py new file mode 100644 index 000000000000..b85a68dcb92d --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_chat_transcripts_operations_async.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. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportChatTranscriptsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_list(self, resource_group): + response = self.client.chat_transcripts.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_get(self, resource_group): + response = await self.client.chat_transcripts.get( + support_ticket_name="str", + chat_transcript_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_no_subscription_operations.py new file mode 100644 index 000000000000..d64f2f51dc53 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_no_subscription_operations.py @@ -0,0 +1,77 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportCommunicationsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_check_name_availability(self, resource_group): + response = self.client.communications_no_subscription.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_list(self, resource_group): + response = self.client.communications_no_subscription.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_get(self, resource_group): + response = self.client.communications_no_subscription.get( + support_ticket_name="str", + communication_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_begin_create(self, resource_group): + response = self.client.communications_no_subscription.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "body": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "sender": "str", + "subject": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_no_subscription_operations_async.py new file mode 100644 index 000000000000..20ab8f44146d --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_no_subscription_operations_async.py @@ -0,0 +1,80 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportCommunicationsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_check_name_availability(self, resource_group): + response = await self.client.communications_no_subscription.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_list(self, resource_group): + response = self.client.communications_no_subscription.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_get(self, resource_group): + response = await self.client.communications_no_subscription.get( + support_ticket_name="str", + communication_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_begin_create(self, resource_group): + response = await ( + await self.client.communications_no_subscription.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "body": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "sender": "str", + "subject": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_operations.py new file mode 100644 index 000000000000..585e1d8e201d --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_operations.py @@ -0,0 +1,77 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportCommunicationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_check_name_availability(self, resource_group): + response = self.client.communications.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_list(self, resource_group): + response = self.client.communications.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_get(self, resource_group): + response = self.client.communications.get( + support_ticket_name="str", + communication_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_begin_create(self, resource_group): + response = self.client.communications.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "body": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "sender": "str", + "subject": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_operations_async.py new file mode 100644 index 000000000000..217b95ac8a20 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_communications_operations_async.py @@ -0,0 +1,80 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportCommunicationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_check_name_availability(self, resource_group): + response = await self.client.communications.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_list(self, resource_group): + response = self.client.communications.list( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_get(self, resource_group): + response = await self.client.communications.get( + support_ticket_name="str", + communication_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_begin_create(self, resource_group): + response = await ( + await self.client.communications.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "body": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "id": "str", + "name": "str", + "sender": "str", + "subject": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_no_subscription_operations.py new file mode 100644 index 000000000000..c87c12c13fdb --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_no_subscription_operations.py @@ -0,0 +1,41 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFileWorkspacesNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_no_subscription_get(self, resource_group): + response = self.client.file_workspaces_no_subscription.get( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_no_subscription_create(self, resource_group): + response = self.client.file_workspaces_no_subscription.create( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_no_subscription_operations_async.py new file mode 100644 index 000000000000..098b3ec7a0d9 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_no_subscription_operations_async.py @@ -0,0 +1,42 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFileWorkspacesNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_no_subscription_get(self, resource_group): + response = await self.client.file_workspaces_no_subscription.get( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_no_subscription_create(self, resource_group): + response = await self.client.file_workspaces_no_subscription.create( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_operations.py new file mode 100644 index 000000000000..b22caf8c5de2 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_operations.py @@ -0,0 +1,41 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFileWorkspacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_get(self, resource_group): + response = self.client.file_workspaces.get( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_create(self, resource_group): + response = self.client.file_workspaces.create( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_operations_async.py new file mode 100644 index 000000000000..fb26abc750ac --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_file_workspaces_operations_async.py @@ -0,0 +1,42 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFileWorkspacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_get(self, resource_group): + response = await self.client.file_workspaces.get( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_create(self, resource_group): + response = await self.client.file_workspaces.create( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_no_subscription_operations.py new file mode 100644 index 000000000000..8764c0587b82 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_no_subscription_operations.py @@ -0,0 +1,84 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFilesNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_list(self, resource_group): + response = self.client.files_no_subscription.list( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_get(self, resource_group): + response = self.client.files_no_subscription.get( + file_workspace_name="str", + file_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_create(self, resource_group): + response = self.client.files_no_subscription.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "chunkSize": 0, + "createdOn": "2020-02-20 00:00:00", + "fileSize": 0, + "id": "str", + "name": "str", + "numberOfChunks": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_upload(self, resource_group): + response = self.client.files_no_subscription.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_no_subscription_operations_async.py new file mode 100644 index 000000000000..56e2c7573f74 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_no_subscription_operations_async.py @@ -0,0 +1,85 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFilesNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_list(self, resource_group): + response = self.client.files_no_subscription.list( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_get(self, resource_group): + response = await self.client.files_no_subscription.get( + file_workspace_name="str", + file_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_create(self, resource_group): + response = await self.client.files_no_subscription.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "chunkSize": 0, + "createdOn": "2020-02-20 00:00:00", + "fileSize": 0, + "id": "str", + "name": "str", + "numberOfChunks": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_upload(self, resource_group): + response = await self.client.files_no_subscription.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_operations.py new file mode 100644 index 000000000000..7a12cd476313 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_operations.py @@ -0,0 +1,84 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFilesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_list(self, resource_group): + response = self.client.files.list( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_get(self, resource_group): + response = self.client.files.get( + file_workspace_name="str", + file_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_create(self, resource_group): + response = self.client.files.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "chunkSize": 0, + "createdOn": "2020-02-20 00:00:00", + "fileSize": 0, + "id": "str", + "name": "str", + "numberOfChunks": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_upload(self, resource_group): + response = self.client.files.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_operations_async.py new file mode 100644 index 000000000000..db768f0f3170 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_files_operations_async.py @@ -0,0 +1,85 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportFilesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_list(self, resource_group): + response = self.client.files.list( + file_workspace_name="str", + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_get(self, resource_group): + response = await self.client.files.get( + file_workspace_name="str", + file_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_create(self, resource_group): + response = await self.client.files.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "chunkSize": 0, + "createdOn": "2020-02-20 00:00:00", + "fileSize": 0, + "id": "str", + "name": "str", + "numberOfChunks": 0, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_upload(self, resource_group): + response = await self.client.files.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_look_up_resource_id_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_look_up_resource_id_operations.py new file mode 100644 index 000000000000..f47bcbd46f4a --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_look_up_resource_id_operations.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportLookUpResourceIdOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_look_up_resource_id_post(self, resource_group): + response = self.client.look_up_resource_id.post( + look_up_resource_id_request={"identifier": "str", "type": "Microsoft.Support/supportTickets"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_look_up_resource_id_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_look_up_resource_id_operations_async.py new file mode 100644 index 000000000000..ffef6d3b07a1 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_look_up_resource_id_operations_async.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportLookUpResourceIdOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_look_up_resource_id_post(self, resource_group): + response = await self.client.look_up_resource_id.post( + look_up_resource_id_request={"identifier": "str", "type": "Microsoft.Support/supportTickets"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_operations.py new file mode 100644 index 000000000000..5a102ebf3796 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_operations.py @@ -0,0 +1,29 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_operations_async.py new file mode 100644 index 000000000000..f547dfb1a5c3 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_operations_async.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list( + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_no_subscription_operations.py new file mode 100644 index 000000000000..1e912eb719cd --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_no_subscription_operations.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportProblemClassificationsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_problem_classifications_no_subscription_classify_problems(self, resource_group): + response = self.client.problem_classifications_no_subscription.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_no_subscription_operations_async.py new file mode 100644 index 000000000000..d15b5e99add2 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_no_subscription_operations_async.py @@ -0,0 +1,32 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportProblemClassificationsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_problem_classifications_no_subscription_classify_problems(self, resource_group): + response = await self.client.problem_classifications_no_subscription.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_operations.py new file mode 100644 index 000000000000..022edb7b269b --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_operations.py @@ -0,0 +1,54 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportProblemClassificationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_problem_classifications_classify_problems(self, resource_group): + response = self.client.problem_classifications.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_problem_classifications_list(self, resource_group): + response = self.client.problem_classifications.list( + service_name="str", + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_problem_classifications_get(self, resource_group): + response = self.client.problem_classifications.get( + service_name="str", + problem_classification_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_operations_async.py new file mode 100644 index 000000000000..8231c463f557 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_problem_classifications_operations_async.py @@ -0,0 +1,55 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportProblemClassificationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_problem_classifications_classify_problems(self, resource_group): + response = await self.client.problem_classifications.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_problem_classifications_list(self, resource_group): + response = self.client.problem_classifications.list( + service_name="str", + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_problem_classifications_get(self, resource_group): + response = await self.client.problem_classifications.get( + service_name="str", + problem_classification_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_no_subscription_operations.py new file mode 100644 index 000000000000..2437e474e644 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_no_subscription_operations.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportServiceClassificationsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_service_classifications_no_subscription_classify_services(self, resource_group): + response = self.client.service_classifications_no_subscription.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_no_subscription_operations_async.py new file mode 100644 index 000000000000..dabc1e3ea43a --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_no_subscription_operations_async.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportServiceClassificationsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_service_classifications_no_subscription_classify_services(self, resource_group): + response = await self.client.service_classifications_no_subscription.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_operations.py new file mode 100644 index 000000000000..527071288709 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_operations.py @@ -0,0 +1,30 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportServiceClassificationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_service_classifications_classify_services(self, resource_group): + response = self.client.service_classifications.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_operations_async.py new file mode 100644 index 000000000000..a27b41025c59 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_service_classifications_operations_async.py @@ -0,0 +1,31 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportServiceClassificationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_service_classifications_classify_services(self, resource_group): + response = await self.client.service_classifications.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_services_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_services_operations.py new file mode 100644 index 000000000000..c20b1ddae60e --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_services_operations.py @@ -0,0 +1,40 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_list(self, resource_group): + response = self.client.services.list( + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_get(self, resource_group): + response = self.client.services.get( + service_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_services_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_services_operations_async.py new file mode 100644 index 000000000000..3b2b3ce222eb --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_services_operations_async.py @@ -0,0 +1,41 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_list(self, resource_group): + response = self.client.services.list( + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_get(self, resource_group): + response = await self.client.services.get( + service_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_no_subscription_operations.py new file mode 100644 index 000000000000..d277ad1e47c8 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_no_subscription_operations.py @@ -0,0 +1,140 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportSupportTicketsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_check_name_availability(self, resource_group): + response = self.client.support_tickets_no_subscription.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_list(self, resource_group): + response = self.client.support_tickets_no_subscription.list( + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_get(self, resource_group): + response = self.client.support_tickets_no_subscription.get( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_update(self, resource_group): + response = self.client.support_tickets_no_subscription.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_begin_create(self, resource_group): + response = self.client.support_tickets_no_subscription.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "createdDate": "2020-02-20 00:00:00", + "description": "str", + "enrollmentId": "str", + "fileWorkspaceName": "str", + "id": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "name": "str", + "problemClassificationDisplayName": "str", + "problemClassificationId": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceId": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "severity": "str", + "status": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + "title": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_no_subscription_operations_async.py new file mode 100644 index 000000000000..5b8327fec87a --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_no_subscription_operations_async.py @@ -0,0 +1,143 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportSupportTicketsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_check_name_availability(self, resource_group): + response = await self.client.support_tickets_no_subscription.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_list(self, resource_group): + response = self.client.support_tickets_no_subscription.list( + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_get(self, resource_group): + response = await self.client.support_tickets_no_subscription.get( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_update(self, resource_group): + response = await self.client.support_tickets_no_subscription.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_begin_create(self, resource_group): + response = await ( + await self.client.support_tickets_no_subscription.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "createdDate": "2020-02-20 00:00:00", + "description": "str", + "enrollmentId": "str", + "fileWorkspaceName": "str", + "id": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "name": "str", + "problemClassificationDisplayName": "str", + "problemClassificationId": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceId": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "severity": "str", + "status": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + "title": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_operations.py new file mode 100644 index 000000000000..20ea037ba667 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_operations.py @@ -0,0 +1,140 @@ +# 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 pytest +from azure.mgmt.support import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportSupportTicketsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_check_name_availability(self, resource_group): + response = self.client.support_tickets.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_list(self, resource_group): + response = self.client.support_tickets.list( + api_version="2023-06-01-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_get(self, resource_group): + response = self.client.support_tickets.get( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_update(self, resource_group): + response = self.client.support_tickets.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_begin_create(self, resource_group): + response = self.client.support_tickets.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "createdDate": "2020-02-20 00:00:00", + "description": "str", + "enrollmentId": "str", + "fileWorkspaceName": "str", + "id": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "name": "str", + "problemClassificationDisplayName": "str", + "problemClassificationId": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceId": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "severity": "str", + "status": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + "title": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_operations_async.py new file mode 100644 index 000000000000..f42d0ed957e7 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_microsoft_support_support_tickets_operations_async.py @@ -0,0 +1,143 @@ +# 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 pytest +from azure.mgmt.support.aio import MicrosoftSupport + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMicrosoftSupportSupportTicketsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MicrosoftSupport, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_check_name_availability(self, resource_group): + response = await self.client.support_tickets.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_list(self, resource_group): + response = self.client.support_tickets.list( + api_version="2023-06-01-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_get(self, resource_group): + response = await self.client.support_tickets.get( + support_ticket_name="str", + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_update(self, resource_group): + response = await self.client.support_tickets.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + api_version="2023-06-01-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_begin_create(self, resource_group): + response = await ( + await self.client.support_tickets.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "createdDate": "2020-02-20 00:00:00", + "description": "str", + "enrollmentId": "str", + "fileWorkspaceName": "str", + "id": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "name": "str", + "problemClassificationDisplayName": "str", + "problemClassificationId": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceId": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "severity": "str", + "status": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + "title": "str", + "type": "str", + }, + api_version="2023-06-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/sdk_packaging.toml b/sdk/support/azure-mgmt-support/sdk_packaging.toml index b17ab7dba4a0..99d78afabbf1 100644 --- a/sdk/support/azure-mgmt-support/sdk_packaging.toml +++ b/sdk/support/azure-mgmt-support/sdk_packaging.toml @@ -3,6 +3,6 @@ package_name = "azure-mgmt-support" package_nspkg = "azure-mgmt-nspkg" package_pprint_name = "Support Management" package_doc_id = "" -is_stable = true +is_stable = false is_arm = true title = "MicrosoftSupport" diff --git a/sdk/support/azure-mgmt-support/setup.py b/sdk/support/azure-mgmt-support/setup.py index 4aafdd3ea16f..047de0dc3d94 100644 --- a/sdk/support/azure-mgmt-support/setup.py +++ b/sdk/support/azure-mgmt-support/setup.py @@ -49,11 +49,10 @@ url="https://github.com/Azure/azure-sdk-for-python", keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product classifiers=[ - "Development Status :: 5 - Production/Stable", + "Development Status :: 4 - Beta", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -75,8 +74,9 @@ }, install_requires=[ "isodate>=0.6.1", + "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", )