From 4e59a48493abf60fa66a315f4078dcdc6a22ec2e Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 20 Mar 2024 02:43:49 +0000 Subject: [PATCH] code and test --- sdk/support/azure-mgmt-support/CHANGELOG.md | 21 + sdk/support/azure-mgmt-support/README.md | 4 +- sdk/support/azure-mgmt-support/_meta.json | 8 +- .../azure/mgmt/support/_configuration.py | 13 +- .../azure/mgmt/support/_microsoft_support.py | 75 ++- .../azure/mgmt/support/_serialization.py | 90 ++-- .../azure/mgmt/support/_version.py | 2 +- .../azure/mgmt/support/aio/_configuration.py | 13 +- .../mgmt/support/aio/_microsoft_support.py | 77 +++- .../mgmt/support/aio/operations/__init__.py | 16 +- ..._transcripts_no_subscription_operations.py | 108 ++++- .../_chat_transcripts_operations.py | 46 +- ...mmunications_no_subscription_operations.py | 226 ++++++---- .../operations/_communications_operations.py | 148 ++---- ...e_workspaces_no_subscription_operations.py | 34 +- .../operations/_file_workspaces_operations.py | 38 +- .../_files_no_subscription_operations.py | 105 ++--- .../aio/operations/_files_operations.py | 113 ++--- .../_look_up_resource_id_operations.py | 161 +++++++ .../support/aio/operations/_operations.py | 26 +- ...ssifications_no_subscription_operations.py | 179 ++++++++ .../_problem_classifications_operations.py | 184 ++++++-- ...ssifications_no_subscription_operations.py | 155 +++++++ .../_service_classifications_operations.py | 156 +++++++ .../aio/operations/_services_operations.py | 45 +- ..._transcripts_no_subscription_operations.py | 138 ------ ...mmunications_no_subscription_operations.py | 157 ------- ...port_tickets_no_subscription_operations.py | 172 +++---- .../operations/_support_tickets_operations.py | 182 +++----- .../azure/mgmt/support/models/__init__.py | 20 + .../models/_microsoft_support_enums.py | 7 + .../azure/mgmt/support/models/_models_py3.py | 426 ++++++++++++++++-- .../azure/mgmt/support/operations/__init__.py | 16 +- ..._transcripts_no_subscription_operations.py | 130 +++++- .../_chat_transcripts_operations.py | 50 +- ...mmunications_no_subscription_operations.py | 259 +++++++---- .../operations/_communications_operations.py | 156 ++----- ...e_workspaces_no_subscription_operations.py | 38 +- .../operations/_file_workspaces_operations.py | 42 +- .../_files_no_subscription_operations.py | 113 ++--- .../support/operations/_files_operations.py | 121 ++--- .../_look_up_resource_id_operations.py | 186 ++++++++ .../mgmt/support/operations/_operations.py | 28 +- ...ssifications_no_subscription_operations.py | 211 +++++++++ .../_problem_classifications_operations.py | 215 +++++++-- ...ssifications_no_subscription_operations.py | 180 ++++++++ .../_service_classifications_operations.py | 186 ++++++++ .../operations/_services_operations.py | 49 +- ..._transcripts_no_subscription_operations.py | 164 ------- ...mmunications_no_subscription_operations.py | 189 -------- ...port_tickets_no_subscription_operations.py | 182 +++----- .../operations/_support_tickets_operations.py | 192 +++----- .../check_name_availability.py | 5 +- ...bscription_support_ticket_communication.py | 5 +- ...bility_for_support_ticket_communication.py | 5 +- ...eck_name_availability_with_subscription.py | 5 +- .../classify_problem_classifications.py | 44 ++ ...roblem_classifications_for_subscription.py | 47 ++ .../generated_samples/classify_services.py | 46 ++ .../classify_services_for_subscription.py | 46 ++ ..._specific_batch_account_for_active_jobs.py | 5 +- ...cific_batch_account_for_dedicated_cores.py | 5 +- ...ic_batch_account_for_low_priority_cores.py | 5 +- ...et_for_specific_batch_account_for_pools.py | 5 +- ...ate_batch_quota_ticket_for_subscription.py | 5 +- .../create_billing_support_ticket.py | 5 +- ...billing_support_ticket_for_subscription.py | 5 +- ...ate_cores_quota_ticket_for_subscription.py | 5 +- .../generated_samples/create_file.py | 5 +- .../create_file_for_subscription.py | 5 +- .../create_file_workspace.py | 3 +- .../create_file_workspace_for_subscription.py | 3 +- .../create_generic_quota_ticket.py | 5 +- ...arning_quota_ticket_for_dedicated_cores.py | 5 +- ...ing_quota_ticket_for_low_priority_cores.py | 5 +- ...bscription_support_ticket_communication.py | 5 +- ...eate_sql_database_quota_ticket_for_dtus.py | 5 +- ...e_sql_database_quota_ticket_for_servers.py | 5 +- ...sql_datawarehouse_quota_ticket_for_dtus.py | 5 +- ..._datawarehouse_quota_ticket_for_servers.py | 5 +- ...reate_sql_managed_instance_quota_ticket.py | 5 +- .../create_sub_mgmt_support_ticket.py | 5 +- ...ub_mgmt_support_ticket_for_subscription.py | 5 +- .../create_support_ticket_communication.py | 5 +- .../create_technical_support_ticket.py | 5 +- ...chnical_support_ticket_for_subscription.py | 5 +- ...details_for_subscription_support_ticket.py | 3 +- ...ommunication_details_for_support_ticket.py | 3 +- .../generated_samples/get_file_details.py | 3 +- .../get_file_details_for_subscription.py | 3 +- .../get_file_workspace_details.py | 3 +- ...file_workspace_details_for_subscription.py | 3 +- .../get_problem_classification.py | 3 +- .../generated_samples/get_service.py | 3 +- ...get_subscription_support_ticket_details.py | 3 +- .../get_support_ticket_details.py | 3 +- ...details_for_subscription_support_ticket.py | 3 +- ...t_transcript_details_for_support_ticket.py | 3 +- ...scripts_for_subscription_support_ticket.py | 3 +- ...ist_chat_transcripts_for_support_ticket.py | 5 +- ...cations_for_subscription_support_ticket.py | 3 +- .../list_communications_for_support_ticket.py | 5 +- ...s_for_subscription_under_file_workspace.py | 3 +- .../list_files_under_file_workspace.py | 3 +- .../generated_samples/list_operations.py | 3 +- .../list_problem_classifications.py | 3 +- .../generated_samples/list_services.py | 3 +- .../generated_samples/list_support_tickets.py | 3 +- .../list_support_tickets_by_subscription.py | 3 +- ...s_created_on_or_after_and_in_open_state.py | 3 +- ...after_and_in_open_state_by_subscription.py | 3 +- ...eated_on_or_after_and_in_updating_state.py | 3 +- ...r_and_in_updating_state_by_subscription.py | 3 +- .../list_support_tickets_in_open_state.py | 3 +- ...t_tickets_in_open_state_by_subscription.py | 3 +- .../list_support_tickets_in_updating_state.py | 3 +- ...ckets_in_updating_state_by_subscription.py | 3 +- ...ickets_problem_classification_id_equals.py | 3 +- ...assification_id_equals_for_subscription.py | 3 +- .../list_support_tickets_service_id_equals.py | 3 +- ...kets_service_id_equals_for_subscription.py | 3 +- ...cations_for_subscription_support_ticket.py | 3 +- ...tion_support_ticket_created_on_or_after.py | 3 +- ...t_web_communications_for_support_ticket.py | 5 +- ..._for_support_ticket_created_on_or_after.py | 5 +- .../generated_samples/look_up_resource_id.py | 43 ++ ...ed_diagnostic_consent_of_support_ticket.py | 5 +- ...sent_of_support_ticket_for_subscription.py | 5 +- ...pdate_contact_details_of_support_ticket.py | 5 +- ...ails_of_support_ticket_for_subscription.py | 5 +- .../update_severity_of_support_ticket.py | 5 +- ...rity_of_support_ticket_for_subscription.py | 5 +- .../update_status_of_support_ticket.py | 5 +- ...atus_of_support_ticket_for_subscription.py | 5 +- .../generated_samples/upload_file.py | 5 +- .../upload_file_for_subscription.py | 5 +- sdk/support/azure-mgmt-support/setup.py | 11 +- 137 files changed, 4023 insertions(+), 2387 deletions(-) create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_look_up_resource_id_operations.py create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_no_subscription_operations.py create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_no_subscription_operations.py create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_operations.py delete mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_chat_transcripts_no_subscription_operations.py delete mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_communications_no_subscription_operations.py create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_look_up_resource_id_operations.py create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_no_subscription_operations.py create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_no_subscription_operations.py create mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_operations.py delete mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_chat_transcripts_no_subscription_operations.py delete mode 100644 sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_communications_no_subscription_operations.py create mode 100644 sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications.py create mode 100644 sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications_for_subscription.py create mode 100644 sdk/support/azure-mgmt-support/generated_samples/classify_services.py create mode 100644 sdk/support/azure-mgmt-support/generated_samples/classify_services_for_subscription.py create mode 100644 sdk/support/azure-mgmt-support/generated_samples/look_up_resource_id.py diff --git a/sdk/support/azure-mgmt-support/CHANGELOG.md b/sdk/support/azure-mgmt-support/CHANGELOG.md index 202f4cc56b4e..9a2d366f7296 100644 --- a/sdk/support/azure-mgmt-support/CHANGELOG.md +++ b/sdk/support/azure-mgmt-support/CHANGELOG.md @@ -1,5 +1,26 @@ # Release History +## 6.1.0b3 (2024-03-18) + +### Features Added + + - Added operation ChatTranscriptsNoSubscriptionOperations.list + - Added operation CommunicationsNoSubscriptionOperations.list + - Added operation ProblemClassificationsOperations.classify_problems + - Added operation group LookUpResourceIdOperations + - Added operation group ProblemClassificationsNoSubscriptionOperations + - Added operation group ServiceClassificationsNoSubscriptionOperations + - Added operation group ServiceClassificationsOperations + - Model ProblemClassification has a new parameter metadata + - Model ProblemClassification has a new parameter parent_problem_classification + - Model Service has a new parameter metadata + - Model SupportTicketDetails has a new parameter is_temporary_ticket + +### Breaking Changes + + - Removed operation group SupportTicketChatTranscriptsNoSubscriptionOperations + - Removed operation group SupportTicketCommunicationsNoSubscriptionOperations + ## 6.1.0b2 (2023-10-23) ### Features Added diff --git a/sdk/support/azure-mgmt-support/README.md b/sdk/support/azure-mgmt-support/README.md index 4326769578f0..bf0a6ac456dc 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.7+. +This package has been tested with Python 3.8+. 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.7+ is required to use this package. +- Python 3.8+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package diff --git a/sdk/support/azure-mgmt-support/_meta.json b/sdk/support/azure-mgmt-support/_meta.json index 0f6c8beca05a..593e7baab098 100644 --- a/sdk/support/azure-mgmt-support/_meta.json +++ b/sdk/support/azure-mgmt-support/_meta.json @@ -1,11 +1,11 @@ { - "commit": "59883fd93ea3f0911d2070a533a3724bf9c2516a", + "commit": "8d6f30424e2667112c888118ac6facc2f639370e", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.9.7", "use": [ - "@autorest/python@6.7.1", - "@autorest/modelerfour@4.26.2" + "@autorest/python@6.13.7", + "@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.7.1 --use=@autorest/modelerfour@4.26.2 --version=3.9.7 --version-tolerant=False", + "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", "readme": "specification/support/resource-manager/readme.md" } \ No newline at end of file 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 951b60fc7cd5..50ef5c20756b 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -19,7 +18,7 @@ from azure.core.credentials import TokenCredential -class MicrosoftSupportConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MicrosoftSupport. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class MicrosoftSupportConfiguration(Configuration): # pylint: disable=too-many- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Azure subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :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: - super(MicrosoftSupportConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-support/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = ARMChallengeAuthenticationPolicy( 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 461bd7f564b7..c9e0e8fd5562 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 @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient +from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from . import models as _models from ._configuration import MicrosoftSupportConfiguration @@ -24,11 +26,13 @@ FileWorkspacesOperations, FilesNoSubscriptionOperations, FilesOperations, + LookUpResourceIdOperations, Operations, + ProblemClassificationsNoSubscriptionOperations, ProblemClassificationsOperations, + ServiceClassificationsNoSubscriptionOperations, + ServiceClassificationsOperations, ServicesOperations, - SupportTicketChatTranscriptsNoSubscriptionOperations, - SupportTicketCommunicationsNoSubscriptionOperations, SupportTicketsNoSubscriptionOperations, SupportTicketsOperations, ) @@ -45,6 +49,17 @@ class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,to :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 @@ -58,16 +73,8 @@ class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,to :ivar communications_no_subscription: CommunicationsNoSubscriptionOperations operations :vartype communications_no_subscription: azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations - :ivar support_ticket_communications_no_subscription: - SupportTicketCommunicationsNoSubscriptionOperations operations - :vartype support_ticket_communications_no_subscription: - azure.mgmt.support.operations.SupportTicketCommunicationsNoSubscriptionOperations :ivar chat_transcripts: ChatTranscriptsOperations operations :vartype chat_transcripts: azure.mgmt.support.operations.ChatTranscriptsOperations - :ivar support_ticket_chat_transcripts_no_subscription: - SupportTicketChatTranscriptsNoSubscriptionOperations operations - :vartype support_ticket_chat_transcripts_no_subscription: - azure.mgmt.support.operations.SupportTicketChatTranscriptsNoSubscriptionOperations :ivar chat_transcripts_no_subscription: ChatTranscriptsNoSubscriptionOperations operations :vartype chat_transcripts_no_subscription: azure.mgmt.support.operations.ChatTranscriptsNoSubscriptionOperations @@ -80,13 +87,15 @@ 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: Azure subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :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 @@ -101,7 +110,25 @@ def __init__( **kwargs: Any ) -> None: self._config = MicrosoftSupportConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + 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) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -109,6 +136,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 ) @@ -120,15 +156,9 @@ def __init__( self.communications_no_subscription = CommunicationsNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) - self.support_ticket_communications_no_subscription = SupportTicketCommunicationsNoSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.chat_transcripts = ChatTranscriptsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.support_ticket_chat_transcripts_no_subscription = SupportTicketChatTranscriptsNoSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.chat_transcripts_no_subscription = ChatTranscriptsNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -140,8 +170,11 @@ 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, **kwargs: Any) -> HttpResponse: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -161,7 +194,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() 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 4bae2292227b..2f781d740827 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py @@ -63,8 +63,8 @@ import isodate # type: ignore -from azure.core.exceptions import DeserializationError, SerializationError, raise_with_traceback -from azure.core.serialization import NULL as AzureCoreNull +from azure.core.exceptions import DeserializationError, SerializationError +from azure.core.serialization import NULL as CoreNull _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") @@ -124,7 +124,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: pass return ET.fromstring(data_as_str) # nosec - except ET.ParseError: + except ET.ParseError as err: # It might be because the server has an issue, and returned JSON with # content-type XML.... # So let's try a JSON load, and if it's still broken @@ -143,7 +143,7 @@ def _json_attemp(data): # The function hack is because Py2.7 messes up with exception # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") - raise_with_traceback(DeserializationError, "XML is invalid") + raise DeserializationError("XML is invalid") from err raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -170,13 +170,6 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], return None -try: - basestring # type: ignore - unicode_str = unicode # type: ignore -except NameError: - basestring = str - unicode_str = str - _LOGGER = logging.getLogger(__name__) try: @@ -295,7 +288,7 @@ class Model(object): _validation: Dict[str, Dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Dict[str, Any] = {} + self.additional_properties: Optional[Dict[str, Any]] = {} for k in kwargs: if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -340,7 +333,7 @@ def _create_xml_node(cls): return _create_xml_node(xml_map.get("name", cls.__name__), xml_map.get("prefix", None), xml_map.get("ns", None)) def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: - """Return the JSON that would be sent to azure from this model. + """Return the JSON that would be sent to server from this model. This is an alias to `as_dict(full_restapi_key_transformer, keep_readonly=False)`. @@ -351,7 +344,7 @@ 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) + return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore def as_dict( self, @@ -390,7 +383,7 @@ def my_key_transformer(key, attr_desc, value): :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) + return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore @classmethod def _infer_class_models(cls): @@ -415,7 +408,7 @@ def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = N :raises: DeserializationError if something went wrong """ deserializer = Deserializer(cls._infer_class_models()) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( @@ -445,7 +438,7 @@ def from_dict( if key_extractors is None else key_extractors ) - return deserializer(cls.__name__, data, content_type=content_type) + return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def _flatten_subtype(cls, key, objects): @@ -545,7 +538,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -561,7 +554,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -649,7 +642,7 @@ def _serialize(self, target_obj, data_type=None, **kwargs): else: # That's a basic type # Integrate namespace if necessary local_node = _create_xml_node(xml_name, xml_prefix, xml_ns) - local_node.text = unicode_str(new_attr) + local_node.text = str(new_attr) serialized.append(local_node) # type: ignore else: # JSON for k in reversed(keys): # type: ignore @@ -668,7 +661,7 @@ 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_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err else: return serialized @@ -710,7 +703,7 @@ def body(self, data, data_type, **kwargs): ] data = deserializer._deserialize(data_type, data) except DeserializationError as err: - raise_with_traceback(SerializationError, "Unable to build a model: " + str(err), err) + raise SerializationError("Unable to build a model: " + str(err)) from err return self._serialize(data, data_type, **kwargs) @@ -730,6 +723,7 @@ def url(self, name, data, data_type, **kwargs): if kwargs.get("skip_quote") is True: output = str(output) + output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") except SerializationError: @@ -744,7 +738,7 @@ def query(self, name, data, data_type, **kwargs): :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 + :rtype: str, list :raises: TypeError if serialization fails. :raises: ValueError if data is None """ @@ -753,7 +747,7 @@ def query(self, name, data, data_type, **kwargs): if data_type.startswith("["): internal_data_type = data_type[1:-1] do_quote = not kwargs.get("skip_quote", False) - return str(self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs)) + return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization output = self.serialize_data(data, data_type, **kwargs) @@ -804,7 +798,7 @@ def serialize_data(self, data, data_type, **kwargs): raise ValueError("No value for given attribute") try: - if data is AzureCoreNull: + if data is CoreNull: return None if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) @@ -824,7 +818,7 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." - raise_with_traceback(SerializationError, msg.format(data, data_type), err) + raise SerializationError(msg.format(data, data_type)) from err else: return self._serialize(data, **kwargs) @@ -993,7 +987,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_basic(attr, self.basic_types[obj_type], **kwargs) if obj_type is _long_type: return self.serialize_long(attr) - if obj_type is unicode_str: + if obj_type is str: return self.serialize_unicode(attr) if obj_type is datetime.datetime: return self.serialize_iso(attr) @@ -1170,10 +1164,10 @@ def serialize_iso(attr, **kwargs): return date + microseconds + "Z" except (ValueError, OverflowError) as err: msg = "Unable to serialize datetime object." - raise_with_traceback(SerializationError, msg, err) + raise SerializationError(msg) from err except AttributeError as err: msg = "ISO-8601 object must be valid Datetime object." - raise_with_traceback(TypeError, msg, err) + raise TypeError(msg) from err @staticmethod def serialize_unix(attr, **kwargs): @@ -1209,7 +1203,6 @@ def rest_key_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1230,7 +1223,6 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): if working_data is None: # If at any point while following flatten JSON path see None, it means # that all properties under are None as well - # https://github.com/Azure/msrest-for-python/issues/197 return None key = ".".join(dict_keys[1:]) @@ -1371,7 +1363,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, @@ -1391,7 +1383,7 @@ def __init__(self, classes: Optional[Mapping[str, Type[ModelType]]] = None): "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, Type[ModelType]] = dict(classes) if classes else {} + self.dependencies: Dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1444,7 +1436,7 @@ def _deserialize(self, target_obj, data): response, class_name = self._classify_target(target_obj, data) - if isinstance(response, basestring): + if isinstance(response, str): return self.deserialize_data(data, response) elif isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) @@ -1481,7 +1473,7 @@ def _deserialize(self, target_obj, data): d_attrs[attr] = value except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: additional_properties = self._build_additional_properties(attributes, data) return self._instantiate_model(response, d_attrs, additional_properties) @@ -1515,14 +1507,14 @@ def _classify_target(self, target, data): if target is None: return None, None - if isinstance(target, basestring): + if isinstance(target, str): try: target = self.dependencies[target] except KeyError: return target, target try: - target = target._classify(data, self.dependencies) + target = target._classify(data, self.dependencies) # type: ignore except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1578,7 +1570,7 @@ def _unpack_content(raw_data, content_type=None): if hasattr(raw_data, "_content_consumed"): return RawDeserializer.deserialize_from_http_generics(raw_data.text, raw_data.headers) - if isinstance(raw_data, (basestring, bytes)) or hasattr(raw_data, "read"): + if isinstance(raw_data, (str, bytes)) or hasattr(raw_data, "read"): return RawDeserializer.deserialize_from_text(raw_data, content_type) # type: ignore return raw_data @@ -1652,7 +1644,7 @@ def deserialize_data(self, data, data_type): except (ValueError, TypeError, AttributeError) as err: msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return self._deserialize(obj_type, data) @@ -1700,7 +1692,7 @@ def deserialize_object(self, attr, **kwargs): if isinstance(attr, ET.Element): # Do no recurse on XML, just return the tree as-is return attr - if isinstance(attr, basestring): + if isinstance(attr, str): return self.deserialize_basic(attr, "str") obj_type = type(attr) if obj_type in self.basic_types: @@ -1757,7 +1749,7 @@ def deserialize_basic(self, attr, data_type): if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, basestring): + elif isinstance(attr, str): if attr.lower() in ["true", "1"]: return True elif attr.lower() in ["false", "0"]: @@ -1808,7 +1800,6 @@ def deserialize_enum(data, enum_obj): data = data.value if isinstance(data, int): # Workaround. We might consider remove it in the future. - # https://github.com/Azure/azure-rest-api-specs/issues/141 try: return list(enum_obj.__members__.values())[data] except IndexError: @@ -1862,10 +1853,10 @@ def deserialize_decimal(attr): if isinstance(attr, ET.Element): attr = attr.text try: - return decimal.Decimal(attr) # type: ignore + return decimal.Decimal(str(attr)) # type: ignore except decimal.DecimalException as err: msg = "Invalid decimal {}".format(attr) - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err @staticmethod def deserialize_long(attr): @@ -1893,7 +1884,7 @@ def deserialize_duration(attr): duration = isodate.parse_duration(attr) except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return duration @@ -1910,7 +1901,7 @@ def deserialize_date(attr): if re.search(r"[^\W\d_]", attr, re.I + re.U): # type: ignore raise DeserializationError("Date must have only digits and -. Received: %s" % attr) # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. - return isodate.parse_date(attr, defaultmonth=None, defaultday=None) + return isodate.parse_date(attr, defaultmonth=0, defaultday=0) @staticmethod def deserialize_time(attr): @@ -1945,7 +1936,7 @@ def deserialize_rfc(attr): date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1982,7 +1973,7 @@ def deserialize_iso(attr): raise OverflowError("Hit max or min date") except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj @@ -1998,9 +1989,10 @@ def deserialize_unix(attr): if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore try: + attr = int(attr) date_obj = datetime.datetime.fromtimestamp(attr, TZ_UTC) except ValueError as err: msg = "Cannot deserialize to unix datetime object." - raise_with_traceback(DeserializationError, msg, err) + raise DeserializationError(msg) from err else: return date_obj 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 4e1ce97b49d9..e87c3bd7d9e4 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 = "6.1.0b2" +VERSION = "6.1.0b3" 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 18fb974aefb2..4cc8a6917847 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 @@ -8,7 +8,6 @@ from typing import Any, TYPE_CHECKING -from azure.core.configuration import Configuration from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -19,7 +18,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftSupportConfiguration(Configuration): # pylint: disable=too-many-instance-attributes +class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for MicrosoftSupport. Note that all parameters used to create this instance are saved as instance @@ -27,16 +26,15 @@ class MicrosoftSupportConfiguration(Configuration): # pylint: disable=too-many- :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Azure subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :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: - super(MicrosoftSupportConfiguration, self).__init__(**kwargs) - api_version: str = kwargs.pop("api_version", "2022-09-01-preview") + api_version: str = kwargs.pop("api_version", "2023-06-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -48,6 +46,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-support/{}".format(VERSION)) + self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) def _configure(self, **kwargs: Any) -> None: @@ -56,9 +55,9 @@ def _configure(self, **kwargs: Any) -> None: self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( 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 8ad32df92019..19eb33514e71 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 @@ -9,8 +9,10 @@ from copy import deepcopy from typing import Any, Awaitable, TYPE_CHECKING +from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient +from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from .. import models as _models from .._serialization import Deserializer, Serializer @@ -24,11 +26,13 @@ FileWorkspacesOperations, FilesNoSubscriptionOperations, FilesOperations, + LookUpResourceIdOperations, Operations, + ProblemClassificationsNoSubscriptionOperations, ProblemClassificationsOperations, + ServiceClassificationsNoSubscriptionOperations, + ServiceClassificationsOperations, ServicesOperations, - SupportTicketChatTranscriptsNoSubscriptionOperations, - SupportTicketCommunicationsNoSubscriptionOperations, SupportTicketsNoSubscriptionOperations, SupportTicketsOperations, ) @@ -45,6 +49,17 @@ class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,to :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 @@ -58,16 +73,8 @@ class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,to :ivar communications_no_subscription: CommunicationsNoSubscriptionOperations operations :vartype communications_no_subscription: azure.mgmt.support.aio.operations.CommunicationsNoSubscriptionOperations - :ivar support_ticket_communications_no_subscription: - SupportTicketCommunicationsNoSubscriptionOperations operations - :vartype support_ticket_communications_no_subscription: - azure.mgmt.support.aio.operations.SupportTicketCommunicationsNoSubscriptionOperations :ivar chat_transcripts: ChatTranscriptsOperations operations :vartype chat_transcripts: azure.mgmt.support.aio.operations.ChatTranscriptsOperations - :ivar support_ticket_chat_transcripts_no_subscription: - SupportTicketChatTranscriptsNoSubscriptionOperations operations - :vartype support_ticket_chat_transcripts_no_subscription: - azure.mgmt.support.aio.operations.SupportTicketChatTranscriptsNoSubscriptionOperations :ivar chat_transcripts_no_subscription: ChatTranscriptsNoSubscriptionOperations operations :vartype chat_transcripts_no_subscription: azure.mgmt.support.aio.operations.ChatTranscriptsNoSubscriptionOperations @@ -80,13 +87,15 @@ 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: Azure subscription Id. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-01-preview". Note that overriding + :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 @@ -101,7 +110,25 @@ def __init__( **kwargs: Any ) -> None: self._config = MicrosoftSupportConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + 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) client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) @@ -109,6 +136,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 ) @@ -120,15 +156,9 @@ def __init__( self.communications_no_subscription = CommunicationsNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) - self.support_ticket_communications_no_subscription = SupportTicketCommunicationsNoSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.chat_transcripts = ChatTranscriptsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.support_ticket_chat_transcripts_no_subscription = SupportTicketChatTranscriptsNoSubscriptionOperations( - self._client, self._config, self._serialize, self._deserialize - ) self.chat_transcripts_no_subscription = ChatTranscriptsNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -140,8 +170,13 @@ 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, **kwargs: Any) -> Awaitable[AsyncHttpResponse]: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. >>> from azure.core.rest import HttpRequest @@ -161,7 +196,7 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncH request_copy = deepcopy(request) request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, **kwargs) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() 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 00cbedb5a139..e6dfd621f375 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 @@ -8,23 +8,21 @@ from ._operations import Operations from ._services_operations import ServicesOperations +from ._service_classifications_no_subscription_operations import ServiceClassificationsNoSubscriptionOperations +from ._service_classifications_operations import ServiceClassificationsOperations +from ._problem_classifications_no_subscription_operations import ProblemClassificationsNoSubscriptionOperations 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 ._support_ticket_communications_no_subscription_operations import ( - SupportTicketCommunicationsNoSubscriptionOperations, -) from ._chat_transcripts_operations import ChatTranscriptsOperations -from ._support_ticket_chat_transcripts_no_subscription_operations import ( - SupportTicketChatTranscriptsNoSubscriptionOperations, -) 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 ._look_up_resource_id_operations import LookUpResourceIdOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -33,19 +31,21 @@ __all__ = [ "Operations", "ServicesOperations", + "ServiceClassificationsNoSubscriptionOperations", + "ServiceClassificationsOperations", + "ProblemClassificationsNoSubscriptionOperations", "ProblemClassificationsOperations", "SupportTicketsOperations", "SupportTicketsNoSubscriptionOperations", "CommunicationsOperations", "CommunicationsNoSubscriptionOperations", - "SupportTicketCommunicationsNoSubscriptionOperations", "ChatTranscriptsOperations", - "SupportTicketChatTranscriptsNoSubscriptionOperations", "ChatTranscriptsNoSubscriptionOperations", "FileWorkspacesOperations", "FileWorkspacesNoSubscriptionOperations", "FilesOperations", "FilesNoSubscriptionOperations", + "LookUpResourceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _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 46c031d76d5a..755d72d51c69 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,8 +6,10 @@ # 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, Optional, TypeVar +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -19,13 +21,14 @@ from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models from ..._vendor import _convert_request -from ...operations._chat_transcripts_no_subscription_operations import build_get_request +from ...operations._chat_transcripts_no_subscription_operations import build_get_request, build_list_request T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -50,6 +53,87 @@ def __init__(self, *args, **kwargs) -> None: self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_models.ChatTranscriptDetails"]: + """Lists all chat transcripts for a support ticket. + + :param support_ticket_name: Support ticket name. Required. + :type support_ticket_name: str + :return: An iterator like instance of either ChatTranscriptDetails or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + support_ticket_name=support_ticket_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ChatTranscriptsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + @distributed_trace_async async def get( self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any @@ -60,7 +144,6 @@ async def get( :type support_ticket_name: str :param chat_transcript_name: ChatTranscript name. Required. :type chat_transcript_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ChatTranscriptDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -79,20 +162,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, chat_transcript_name=chat_transcript_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -105,10 +187,6 @@ async def get( deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" - } + return 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 09158c58cb72..3edc30641c9b 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -59,7 +59,6 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_model :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ChatTranscriptDetails or the result of cls(response) :rtype: @@ -83,16 +82,15 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -104,13 +102,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ChatTranscriptsListResult", pipeline_response) @@ -120,11 +118,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -137,10 +135,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts" - } - @distributed_trace_async async def get( self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any @@ -151,7 +145,6 @@ async def get( :type support_ticket_name: str :param chat_transcript_name: ChatTranscript name. Required. :type chat_transcript_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ChatTranscriptDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -170,21 +163,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, chat_transcript_name=chat_transcript_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -197,10 +189,6 @@ async def get( deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" - } + return 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 703ece827afe..4cf8c6427c3b 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,8 +7,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse +from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, @@ -21,6 +23,7 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat @@ -32,6 +35,7 @@ build_check_name_availability_request, build_create_request, build_get_request, + build_list_request, ) T = TypeVar("T") @@ -76,7 +80,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -86,7 +89,7 @@ async def check_name_availability( async def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: IO, + check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -97,11 +100,10 @@ async def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -111,7 +113,7 @@ async def check_name_availability( async def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], + check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of @@ -120,13 +122,9 @@ async def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -154,22 +152,21 @@ async def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( support_ticket_name=support_ticket_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,13 +179,109 @@ async def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, support_ticket_name: str, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncIterable["_models.CommunicationDetails"]: + """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. + + :param support_ticket_name: Support ticket name. Required. + :type support_ticket_name: str + :param top: The number of values to return in the collection. Default is 10 and max is 10. + Default value is None. + :type top: int + :param filter: The filter to apply on the operation. You can filter by communicationType and + createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate + supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the + CommunicationType and CreatedDate filters by Logical And ('and') operator. Default value is + None. + :type filter: str + :return: An iterator like instance of either CommunicationDetails or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + support_ticket_name=support_ticket_name, + top=top, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CommunicationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - return deserialized + return pipeline_response - check_name_availability.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" - } + return AsyncItemPaged(get_next, extract_data) @distributed_trace_async async def get( @@ -200,7 +293,6 @@ async def get( :type support_ticket_name: str :param communication_name: Communication name. Required. :type communication_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -219,20 +311,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, communication_name=communication_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -245,19 +336,15 @@ async def get( deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore async def _create_initial( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.CommunicationDetails]: error_map = { @@ -283,23 +370,22 @@ async def _create_initial( else: _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, communication_name=communication_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -318,13 +404,9 @@ async def _create_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _create_initial.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -347,14 +429,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -366,7 +440,7 @@ async def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: IO, + create_communication_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -378,18 +452,10 @@ async def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: IO + :type create_communication_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -401,7 +467,7 @@ async def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CommunicationDetails]: """Adds a new customer communication to an Azure support ticket. @@ -411,19 +477,9 @@ async def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Is either a CommunicationDetails - type or a IO type. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + IO[bytes] :return: An instance of AsyncLROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -455,7 +511,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -468,14 +524,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CommunicationDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return AsyncLROPoller[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 03daf23b2c5a..3e7cb58c22f6 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -80,7 +80,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -90,7 +89,7 @@ async def check_name_availability( async def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: IO, + check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -101,11 +100,10 @@ async def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -115,7 +113,7 @@ async def check_name_availability( async def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], + check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of @@ -124,13 +122,9 @@ async def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -158,23 +152,22 @@ async def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -187,13 +180,9 @@ async def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" - } + return deserialized # type: ignore @distributed_trace def list( @@ -218,7 +207,6 @@ def list( CommunicationType and CreatedDate filters by Logical And ('and') operator. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CommunicationDetails or the result of cls(response) :rtype: @@ -242,18 +230,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, top=top, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -265,13 +252,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("CommunicationsListResult", pipeline_response) @@ -281,11 +268,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -298,10 +285,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications" - } - @distributed_trace_async async def get( self, support_ticket_name: str, communication_name: str, **kwargs: Any @@ -312,7 +295,6 @@ async def get( :type support_ticket_name: str :param communication_name: Communication name. Required. :type communication_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -331,21 +313,20 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, communication_name=communication_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -358,19 +339,15 @@ async def get( deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore async def _create_initial( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.CommunicationDetails]: error_map = { @@ -396,7 +373,7 @@ async def _create_initial( else: _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, communication_name=communication_name, subscription_id=self._config.subscription_id, @@ -404,16 +381,15 @@ async def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -428,13 +404,9 @@ async def _create_initial( deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -457,14 +429,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -476,7 +440,7 @@ async def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: IO, + create_communication_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -488,18 +452,10 @@ async def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: IO + :type create_communication_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -511,7 +467,7 @@ async def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.CommunicationDetails]: """Adds a new customer communication to an Azure support ticket. @@ -521,19 +477,9 @@ async def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Is either a CommunicationDetails - type or a IO type. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + IO[bytes] :return: An instance of AsyncLROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -565,7 +511,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -578,14 +524,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.CommunicationDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return AsyncLROPoller[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 7c62f4801cd5..783df934f0c6 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -56,7 +56,6 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -75,19 +74,18 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -100,11 +98,9 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}"} + return deserialized # type: ignore @distributed_trace_async async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -112,7 +108,6 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW :param file_workspace_name: File workspace name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -131,19 +126,18 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, api_version=api_version, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -156,8 +150,6 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}"} + return 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 33afa6cf9d41..4294736acf51 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -56,7 +56,6 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -75,20 +74,19 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -101,13 +99,9 @@ async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWork deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - } + return deserialized # type: ignore @distributed_trace_async async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -115,7 +109,6 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW :param file_workspace_name: File workspace name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -134,20 +127,19 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,10 +152,6 @@ async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileW deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - } + return 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 37f9a7eea2d4..316fbe98d52f 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -65,7 +65,6 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_model :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileDetails or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.FileDetails] :raises ~azure.core.exceptions.HttpResponseError: @@ -87,15 +86,14 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( file_workspace_name=file_workspace_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -107,13 +105,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FilesListResult", pipeline_response) @@ -123,11 +121,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -140,8 +138,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files"} - @distributed_trace_async async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: """Returns details of a specific file in a work space. @@ -150,7 +146,6 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -169,20 +164,19 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, file_name=file_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -195,11 +189,9 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}"} + return deserialized # type: ignore @overload async def create( @@ -222,7 +214,6 @@ async def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -233,7 +224,7 @@ async def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: IO, + create_file_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -245,11 +236,10 @@ async def create( :param file_name: File name. Required. :type file_name: str :param create_file_parameters: Create file object. Required. - :type create_file_parameters: IO + :type create_file_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -260,7 +250,7 @@ async def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: Union[_models.FileDetails, IO], + create_file_parameters: Union[_models.FileDetails, IO[bytes]], **kwargs: Any ) -> _models.FileDetails: """Creates a new file under a workspace. @@ -269,13 +259,9 @@ async def create( :type file_workspace_name: str :param file_name: File name. Required. :type file_name: str - :param create_file_parameters: Create file object. Is either a FileDetails type or a IO type. - Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param create_file_parameters: Create file object. Is either a FileDetails type or a IO[bytes] + type. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO[bytes] :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -303,23 +289,22 @@ async def create( else: _json = self._serialize.body(create_file_parameters, "FileDetails") - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, file_name=file_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -332,11 +317,9 @@ async def create( deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}"} + return deserialized # type: ignore @overload async def upload( # pylint: disable=inconsistent-return-statements @@ -359,7 +342,6 @@ async def upload( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -370,7 +352,7 @@ async def upload( # pylint: disable=inconsistent-return-statements self, file_workspace_name: str, file_name: str, - upload_file: IO, + upload_file: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -382,11 +364,10 @@ async def upload( # pylint: disable=inconsistent-return-statements :param file_name: File Name. Required. :type file_name: str :param upload_file: UploadFile object. Required. - :type upload_file: IO + :type upload_file: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -394,7 +375,7 @@ async def upload( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def upload( # pylint: disable=inconsistent-return-statements - self, file_workspace_name: str, file_name: str, upload_file: Union[_models.UploadFile, IO], **kwargs: Any + 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. @@ -402,12 +383,9 @@ async def upload( # pylint: disable=inconsistent-return-statements :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :param upload_file: UploadFile object. Is either a UploadFile type or a IO type. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param upload_file: UploadFile object. Is either a UploadFile type or a IO[bytes] type. + Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -435,23 +413,22 @@ async def upload( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(upload_file, "UploadFile") - request = build_upload_request( + _request = build_upload_request( file_workspace_name=file_workspace_name, file_name=file_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -462,6 +439,4 @@ async def upload( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - upload.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload"} + return cls(pipeline_response, None, {}) # type: ignore 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 7017ab9827d7..a074dec56bdb 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -65,7 +65,6 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_model :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileDetails or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.FileDetails] :raises ~azure.core.exceptions.HttpResponseError: @@ -87,16 +86,15 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_model def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( file_workspace_name=file_workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -108,13 +106,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("FilesListResult", pipeline_response) @@ -124,11 +122,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -141,10 +139,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files" - } - @distributed_trace_async async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: """Returns details of a specific file in a work space. @@ -153,7 +147,6 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -172,21 +165,20 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, file_name=file_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -199,13 +191,9 @@ async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" - } + return deserialized # type: ignore @overload async def create( @@ -228,7 +216,6 @@ async def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -239,7 +226,7 @@ async def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: IO, + create_file_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -251,11 +238,10 @@ async def create( :param file_name: File name. Required. :type file_name: str :param create_file_parameters: Create file object. Required. - :type create_file_parameters: IO + :type create_file_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -266,7 +252,7 @@ async def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: Union[_models.FileDetails, IO], + create_file_parameters: Union[_models.FileDetails, IO[bytes]], **kwargs: Any ) -> _models.FileDetails: """Creates a new file under a workspace for the specified subscription. @@ -275,13 +261,9 @@ async def create( :type file_workspace_name: str :param file_name: File name. Required. :type file_name: str - :param create_file_parameters: Create file object. Is either a FileDetails type or a IO type. - Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param create_file_parameters: Create file object. Is either a FileDetails type or a IO[bytes] + type. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO[bytes] :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -309,7 +291,7 @@ async def create( else: _json = self._serialize.body(create_file_parameters, "FileDetails") - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, file_name=file_name, subscription_id=self._config.subscription_id, @@ -317,16 +299,15 @@ async def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -339,13 +320,9 @@ async def create( deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" - } + return deserialized # type: ignore @overload async def upload( # pylint: disable=inconsistent-return-statements @@ -368,7 +345,6 @@ async def upload( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -379,7 +355,7 @@ async def upload( # pylint: disable=inconsistent-return-statements self, file_workspace_name: str, file_name: str, - upload_file: IO, + upload_file: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -391,11 +367,10 @@ async def upload( # pylint: disable=inconsistent-return-statements :param file_name: File Name. Required. :type file_name: str :param upload_file: UploadFile object. Required. - :type upload_file: IO + :type upload_file: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -403,7 +378,7 @@ async def upload( # pylint: disable=inconsistent-return-statements @distributed_trace_async async def upload( # pylint: disable=inconsistent-return-statements - self, file_workspace_name: str, file_name: str, upload_file: Union[_models.UploadFile, IO], **kwargs: Any + 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. @@ -411,12 +386,9 @@ async def upload( # pylint: disable=inconsistent-return-statements :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :param upload_file: UploadFile object. Is either a UploadFile type or a IO type. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param upload_file: UploadFile object. Is either a UploadFile type or a IO[bytes] type. + Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -444,7 +416,7 @@ async def upload( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(upload_file, "UploadFile") - request = build_upload_request( + _request = build_upload_request( file_workspace_name=file_workspace_name, file_name=file_name, subscription_id=self._config.subscription_id, @@ -452,16 +424,15 @@ async def upload( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -472,8 +443,4 @@ async def upload( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - upload.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" - } + return cls(pipeline_response, None, {}) # type: ignore 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..e01e559d75cc --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_look_up_resource_id_operations.py @@ -0,0 +1,161 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._look_up_resource_id_operations import build_post_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LookUpResourceIdResponse", pipeline_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 0d9c8fa4a0b6..f35fe0803df8 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -56,7 +56,6 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: """This lists all the available Microsoft Support REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -78,14 +77,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -97,13 +95,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("OperationsListResult", pipeline_response) @@ -113,11 +111,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -129,5 +127,3 @@ async def get_next(next_link=None): return pipeline_response return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Support/operations"} 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..59c7f026d753 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_no_subscription_operations.py @@ -0,0 +1,179 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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_no_subscription_operations import build_classify_problems_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProblemClassificationsClassificationOutput", pipeline_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 9667bf898496..10d1a4695d2e 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from io import IOBase +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -28,7 +29,11 @@ from ... import models as _models from ..._vendor import _convert_request -from ...operations._problem_classifications_operations import build_get_request, build_list_request +from ...operations._problem_classifications_operations import ( + build_classify_problems_request, + build_get_request, + build_list_request, +) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -53,6 +58,134 @@ def __init__(self, *args, **kwargs) -> None: 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") + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProblemClassificationsClassificationOutput", pipeline_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"]: """Lists all the problem classifications (categories) available for a specific Azure service. @@ -62,7 +195,6 @@ def list(self, service_name: str, **kwargs: Any) -> AsyncIterable["_models.Probl :param service_name: Name of the Azure service for which the problem classifications need to be retrieved. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProblemClassification or the result of cls(response) :rtype: @@ -86,15 +218,14 @@ def list(self, service_name: str, **kwargs: Any) -> AsyncIterable["_models.Probl def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( service_name=service_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -106,13 +237,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ProblemClassificationsListResult", pipeline_response) @@ -122,11 +253,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -139,19 +270,17 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/services/{serviceName}/problemClassifications"} - @distributed_trace_async async 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProblemClassification or the result of cls(response) :rtype: ~azure.mgmt.support.models.ProblemClassification :raises ~azure.core.exceptions.HttpResponseError: @@ -170,20 +299,19 @@ async def get( api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProblemClassification] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( service_name=service_name, problem_classification_name=problem_classification_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -196,10 +324,6 @@ async def get( deserialized = self._deserialize("ProblemClassification", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}" - } + return 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..f6ff7b3b8262 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_no_subscription_operations.py @@ -0,0 +1,155 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._service_classifications_no_subscription_operations import build_classify_services_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceClassificationOutput", pipeline_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..b74ba059a0d5 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_service_classifications_operations.py @@ -0,0 +1,156 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_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._service_classifications_operations import build_classify_services_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceClassificationOutput", pipeline_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 34b87d5f966f..273616e95988 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -63,7 +63,6 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Service"]: programmatically for support ticket creation. This practice ensures that you always have the most recent set of service and problem classification Ids. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Service or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.Service] :raises ~azure.core.exceptions.HttpResponseError: @@ -85,14 +84,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Service"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -104,13 +102,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("ServicesListResult", pipeline_response) @@ -120,11 +118,11 @@ async def extract_data(pipeline_response): return None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -137,15 +135,13 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/services"} - @distributed_trace_async 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: Service or the result of cls(response) :rtype: ~azure.mgmt.support.models.Service :raises ~azure.core.exceptions.HttpResponseError: @@ -164,19 +160,18 @@ async def get(self, service_name: str, **kwargs: Any) -> _models.Service: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Service] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( service_name=service_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -189,8 +184,6 @@ async def get(self, service_name: str, **kwargs: Any) -> _models.Service: deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/Microsoft.Support/services/{serviceName}"} + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_chat_transcripts_no_subscription_operations.py deleted file mode 100644 index 332af95b3d00..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_chat_transcripts_no_subscription_operations.py +++ /dev/null @@ -1,138 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._support_ticket_chat_transcripts_no_subscription_operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SupportTicketChatTranscriptsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`support_ticket_chat_transcripts_no_subscription` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncIterable["_models.ChatTranscriptDetails"]: - """Lists all chat transcripts for a support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ChatTranscriptDetails or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - support_ticket_name=support_ticket_name, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ChatTranscriptsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts"} diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_communications_no_subscription_operations.py deleted file mode 100644 index 220c877f1815..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_ticket_communications_no_subscription_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._support_ticket_communications_no_subscription_operations import build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SupportTicketCommunicationsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`support_ticket_communications_no_subscription` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, support_ticket_name: str, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.CommunicationDetails"]: - """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. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param top: The number of values to return in the collection. Default is 10 and max is 10. - Default value is None. - :type top: int - :param filter: The filter to apply on the operation. You can filter by communicationType and - createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate - supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the - CommunicationType and CreatedDate filters by Logical And ('and') operator. Default value is - None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CommunicationDetails or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.CommunicationDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - support_ticket_name=support_ticket_name, - top=top, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CommunicationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications"} 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 ed2376faf19f..62a9209d7068 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -86,17 +85,16 @@ async def check_name_availability( @overload async def check_name_availability( - self, check_name_availability_input: IO, *, content_type: str = "application/json", **kwargs: Any + self, check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -104,19 +102,15 @@ async def check_name_availability( @distributed_trace_async async def check_name_availability( - self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **kwargs: Any + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -144,21 +138,20 @@ async def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -171,11 +164,9 @@ async def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - check_name_availability.metadata = {"url": "/providers/Microsoft.Support/checkNameAvailability"} + return deserialized # type: ignore @distributed_trace def list( @@ -200,7 +191,6 @@ def list( :code:`CreatedDate` filter, the supported operators are 'gt' and 'ge'. When using both filters, combine them using the logical 'AND'. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SupportTicketDetails or the result of cls(response) :rtype: @@ -224,16 +214,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( top=top, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -245,13 +234,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("SupportTicketsListResult", pipeline_response) @@ -261,11 +250,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -278,8 +267,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/supportTickets"} - @distributed_trace_async async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: """Gets details for a specific support ticket. Support ticket data is available for 18 months @@ -288,7 +275,6 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -307,19 +293,18 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -332,11 +317,9 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return deserialized # type: ignore @overload async def update( @@ -360,7 +343,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -370,7 +352,7 @@ async def update( async def update( self, support_ticket_name: str, - update_support_ticket: IO, + update_support_ticket: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -384,11 +366,10 @@ async def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: IO + :type update_support_ticket: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -396,7 +377,10 @@ async def update( @distributed_trace_async async def update( - self, support_ticket_name: str, update_support_ticket: Union[_models.UpdateSupportTicket, IO], **kwargs: Any + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, IO[bytes]], + **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 @@ -407,12 +391,8 @@ async def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - or a IO type. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO[bytes] :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -440,22 +420,21 @@ async def update( else: _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - request = build_update_request( + _request = build_update_request( support_ticket_name=support_ticket_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -468,16 +447,14 @@ async def update( deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return deserialized # type: ignore async def _create_initial( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.SupportTicketDetails]: error_map = { @@ -503,22 +480,21 @@ async def _create_initial( else: _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -537,11 +513,9 @@ async def _create_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _create_initial.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return deserialized # type: ignore @overload async def begin_create( @@ -572,14 +546,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -590,7 +556,7 @@ async def begin_create( async def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: IO, + create_support_ticket_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -611,18 +577,10 @@ async def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Required. - :type create_support_ticket_parameters: IO + :type create_support_ticket_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -633,7 +591,7 @@ async def begin_create( async def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the @@ -652,19 +610,9 @@ async def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Is either a - SupportTicketDetails type or a IO type. Required. - :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + IO[bytes] :return: An instance of AsyncLROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -695,7 +643,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -708,12 +656,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.SupportTicketDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return AsyncLROPoller[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 be69ad155211..2ac02397efcd 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -78,7 +78,6 @@ async def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -86,17 +85,16 @@ async def check_name_availability( @overload async def check_name_availability( - self, check_name_availability_input: IO, *, content_type: str = "application/json", **kwargs: Any + self, check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -104,19 +102,15 @@ async def check_name_availability( @distributed_trace_async async def check_name_availability( - self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **kwargs: Any + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -144,22 +138,21 @@ async def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -172,13 +165,9 @@ async def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability" - } + return deserialized # type: ignore @distributed_trace def list( @@ -201,7 +190,6 @@ def list( Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SupportTicketDetails or the result of cls(response) :rtype: @@ -225,17 +213,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, top=top, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -247,13 +234,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request async def extract_data(pipeline_response): deserialized = self._deserialize("SupportTicketsListResult", pipeline_response) @@ -263,11 +250,11 @@ async def extract_data(pipeline_response): return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -280,8 +267,6 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets"} - @distributed_trace_async async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: """Get ticket details for an Azure subscription. Support ticket data is available for 18 months @@ -290,7 +275,6 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -309,20 +293,19 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -335,13 +318,9 @@ async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportT deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return deserialized # type: ignore @overload async def update( @@ -365,7 +344,6 @@ async def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -375,7 +353,7 @@ async def update( async def update( self, support_ticket_name: str, - update_support_ticket: IO, + update_support_ticket: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -389,11 +367,10 @@ async def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: IO + :type update_support_ticket: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -401,7 +378,10 @@ async def update( @distributed_trace_async async def update( - self, support_ticket_name: str, update_support_ticket: Union[_models.UpdateSupportTicket, IO], **kwargs: Any + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, IO[bytes]], + **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 @@ -412,12 +392,8 @@ async def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - or a IO type. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO[bytes] :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -445,23 +421,22 @@ async def update( else: _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - request = build_update_request( + _request = build_update_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -474,18 +449,14 @@ async def update( deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return deserialized # type: ignore async def _create_initial( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.SupportTicketDetails]: error_map = { @@ -511,23 +482,22 @@ async def _create_initial( else: _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -542,13 +512,9 @@ async def _create_initial( deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return deserialized # type: ignore @overload async def begin_create( @@ -586,14 +552,6 @@ async def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -604,7 +562,7 @@ async def begin_create( async def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: IO, + create_support_ticket_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -632,18 +590,10 @@ async def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Required. - :type create_support_ticket_parameters: IO + :type create_support_ticket_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of AsyncLROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -654,7 +604,7 @@ async def begin_create( async def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> AsyncLROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, @@ -680,19 +630,9 @@ async def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Is either a - SupportTicketDetails type or a IO type. Required. - :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for - this operation to not poll, or pass in your own initialized polling object for a personal - polling strategy. - :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + IO[bytes] :return: An instance of AsyncLROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -723,7 +663,7 @@ async def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -736,14 +676,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return AsyncLROPoller.from_continuation_token( + return AsyncLROPoller[_models.SupportTicketDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return AsyncLROPoller[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 9b63dfa1c5ba..8403052a5398 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 @@ -10,6 +10,7 @@ from ._models_py3 import ChatTranscriptsListResult from ._models_py3 import CheckNameAvailabilityInput from ._models_py3 import CheckNameAvailabilityOutput +from ._models_py3 import ClassificationService from ._models_py3 import CommunicationDetails from ._models_py3 import CommunicationsListResult from ._models_py3 import ContactProfile @@ -19,11 +20,16 @@ from ._models_py3 import FileDetails from ._models_py3 import FileWorkspaceDetails from ._models_py3 import FilesListResult +from ._models_py3 import LookUpResourceIdRequest +from ._models_py3 import LookUpResourceIdResponse 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 ProblemClassificationsClassificationInput +from ._models_py3 import ProblemClassificationsClassificationOutput +from ._models_py3 import ProblemClassificationsClassificationResult from ._models_py3 import ProblemClassificationsListResult from ._models_py3 import ProxyResource from ._models_py3 import QuotaChangeRequest @@ -32,6 +38,9 @@ from ._models_py3 import SecondaryConsent from ._models_py3 import SecondaryConsentEnabled from ._models_py3 import Service +from ._models_py3 import ServiceClassificationAnswer +from ._models_py3 import ServiceClassificationOutput +from ._models_py3 import ServiceClassificationRequest from ._models_py3 import ServiceLevelAgreement from ._models_py3 import ServicesListResult from ._models_py3 import SupportEngineer @@ -47,6 +56,7 @@ 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 @@ -62,6 +72,7 @@ "ChatTranscriptsListResult", "CheckNameAvailabilityInput", "CheckNameAvailabilityOutput", + "ClassificationService", "CommunicationDetails", "CommunicationsListResult", "ContactProfile", @@ -71,11 +82,16 @@ "FileDetails", "FileWorkspaceDetails", "FilesListResult", + "LookUpResourceIdRequest", + "LookUpResourceIdResponse", "MessageProperties", "Operation", "OperationDisplay", "OperationsListResult", "ProblemClassification", + "ProblemClassificationsClassificationInput", + "ProblemClassificationsClassificationOutput", + "ProblemClassificationsClassificationResult", "ProblemClassificationsListResult", "ProxyResource", "QuotaChangeRequest", @@ -84,6 +100,9 @@ "SecondaryConsent", "SecondaryConsentEnabled", "Service", + "ServiceClassificationAnswer", + "ServiceClassificationOutput", + "ServiceClassificationRequest", "ServiceLevelAgreement", "ServicesListResult", "SupportEngineer", @@ -98,6 +117,7 @@ "CommunicationType", "Consent", "CreatedByType", + "IsTemporaryTicket", "PreferredContactMethod", "SeverityLevel", "Status", diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_microsoft_support_enums.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_microsoft_support_enums.py index 11c39b1be829..f545cc2f04df 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_microsoft_support_enums.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_microsoft_support_enums.py @@ -40,6 +40,13 @@ class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): KEY = "Key" +class IsTemporaryTicket(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This property indicates if support ticket is a temporary ticket.""" + + YES = "Yes" + NO = "No" + + class PreferredContactMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Preferred contact method.""" 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 e89d6b1b99ae..c6debb02b77c 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, List, Optional, TYPE_CHECKING, Union +from typing import Any, List, Literal, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -23,7 +23,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}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -65,7 +65,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}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -77,24 +77,6 @@ class ProxyResource(Resource): :vartype system_data: ~azure.mgmt.support.models.SystemData """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - class ChatTranscriptDetails(ProxyResource): """Object that represents a Chat Transcript resource. @@ -102,7 +84,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}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -180,7 +162,7 @@ def __init__( class CheckNameAvailabilityInput(_serialization.Model): """Input of CheckNameAvailability API. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar name: The resource name to validate. Required. :vartype name: str @@ -245,6 +227,41 @@ def __init__(self, **kwargs: Any) -> None: self.message = 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 = None + self.display_name = None + self.resource_types = resource_types + + class CommunicationDetails(_serialization.Model): """Object that represents a Communication resource. @@ -352,7 +369,7 @@ def __init__( class ContactProfile(_serialization.Model): """Contact information associated with the support ticket. - All required parameters must be populated in order to send to Azure. + All required parameters must be populated in order to send to server. :ivar first_name: First name. Required. :vartype first_name: str @@ -560,7 +577,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}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -573,11 +590,11 @@ class FileDetails(ProxyResource): :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. - :vartype chunk_size: float + :vartype chunk_size: int :ivar file_size: Size of the file to be uploaded. - :vartype file_size: float + :vartype file_size: int :ivar number_of_chunks: Number of chunks to be uploaded. - :vartype number_of_chunks: float + :vartype number_of_chunks: int """ _validation = { @@ -594,26 +611,26 @@ class FileDetails(ProxyResource): "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, "created_on": {"key": "properties.createdOn", "type": "iso-8601"}, - "chunk_size": {"key": "properties.chunkSize", "type": "float"}, - "file_size": {"key": "properties.fileSize", "type": "float"}, - "number_of_chunks": {"key": "properties.numberOfChunks", "type": "float"}, + "chunk_size": {"key": "properties.chunkSize", "type": "int"}, + "file_size": {"key": "properties.fileSize", "type": "int"}, + "number_of_chunks": {"key": "properties.numberOfChunks", "type": "int"}, } def __init__( self, *, - chunk_size: Optional[float] = None, - file_size: Optional[float] = None, - number_of_chunks: Optional[float] = None, + chunk_size: Optional[int] = None, + file_size: Optional[int] = None, + number_of_chunks: Optional[int] = None, **kwargs: Any ) -> None: """ :keyword chunk_size: Size of each chunk. - :paramtype chunk_size: float + :paramtype chunk_size: int :keyword file_size: Size of the file to be uploaded. - :paramtype file_size: float + :paramtype file_size: int :keyword number_of_chunks: Number of chunks to be uploaded. - :paramtype number_of_chunks: float + :paramtype number_of_chunks: int """ super().__init__(**kwargs) self.created_on = None @@ -656,7 +673,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}". + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long :vartype id: str :ivar name: The name of the resource. :vartype name: str @@ -697,12 +714,66 @@ def __init__(self, **kwargs: Any) -> None: self.expiration_time = 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): """Describes the properties of a Message Details 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 Azure. + 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 @@ -851,12 +922,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 = { @@ -865,6 +942,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__( @@ -872,6 +954,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: """ @@ -880,6 +963,9 @@ 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 @@ -887,6 +973,130 @@ def __init__( self.type = None self.display_name = display_name self.secondary_consent_enabled = secondary_consent_enabled + self.metadata = 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 = None + self.title = None + self.description = None + self.service_id = None + self.problem_classification_id = None + self.service_id_related_service_id = None + self.display_name = None + self.resource_types = resource_types class ProblemClassificationsListResult(_serialization.Model): @@ -1055,12 +1265,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 = { @@ -1069,6 +1282,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__( @@ -1086,6 +1300,120 @@ def __init__( self.type = None self.display_name = display_name self.resource_types = resource_types + self.metadata = 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): @@ -1230,6 +1558,9 @@ class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-in :vartype modified_date: ~datetime.datetime :ivar file_workspace_name: File workspace name. :vartype file_workspace_name: str + :ivar is_temporary_ticket: This property indicates if support ticket is a temporary ticket. + Known values are: "Yes" and "No". + :vartype is_temporary_ticket: str or ~azure.mgmt.support.models.IsTemporaryTicket :ivar technical_ticket_details: Additional ticket details associated with a technical support ticket request. :vartype technical_ticket_details: ~azure.mgmt.support.models.TechnicalTicketDetails @@ -1245,13 +1576,13 @@ class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-in "name": {"readonly": True}, "type": {"readonly": True}, "problem_classification_display_name": {"readonly": True}, - "enrollment_id": {"readonly": True}, "support_plan_type": {"readonly": True}, "support_plan_display_name": {"readonly": True}, "service_display_name": {"readonly": True}, "status": {"readonly": True}, "created_date": {"readonly": True}, "modified_date": {"readonly": True}, + "is_temporary_ticket": {"readonly": True}, } _attribute_map = { @@ -1281,6 +1612,7 @@ class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-in "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, "modified_date": {"key": "properties.modifiedDate", "type": "iso-8601"}, "file_workspace_name": {"key": "properties.fileWorkspaceName", "type": "str"}, + "is_temporary_ticket": {"key": "properties.isTemporaryTicket", "type": "str"}, "technical_ticket_details": {"key": "properties.technicalTicketDetails", "type": "TechnicalTicketDetails"}, "quota_ticket_details": {"key": "properties.quotaTicketDetails", "type": "QuotaTicketDetails"}, "secondary_consent": {"key": "properties.secondaryConsent", "type": "[SecondaryConsent]"}, @@ -1293,6 +1625,7 @@ def __init__( # pylint: disable=too-many-locals 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, @@ -1324,6 +1657,8 @@ def __init__( # pylint: disable=too-many-locals 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 @@ -1369,7 +1704,7 @@ def __init__( # pylint: disable=too-many-locals self.problem_classification_id = problem_classification_id self.problem_classification_display_name = None self.severity = severity - self.enrollment_id = None + self.enrollment_id = enrollment_id self.require24_x7_response = require24_x7_response self.advanced_diagnostic_consent = advanced_diagnostic_consent self.problem_scoping_questions = problem_scoping_questions @@ -1387,6 +1722,7 @@ def __init__( # pylint: disable=too-many-locals self.created_date = None self.modified_date = None self.file_workspace_name = file_workspace_name + self.is_temporary_ticket = None self.technical_ticket_details = technical_ticket_details self.quota_ticket_details = quota_ticket_details self.secondary_consent = secondary_consent @@ -1673,20 +2009,20 @@ class UploadFile(_serialization.Model): :ivar content: File Content in base64 encoded format. :vartype content: str :ivar chunk_index: Index of the uploaded chunk (Index starts at 0). - :vartype chunk_index: float + :vartype chunk_index: int """ _attribute_map = { "content": {"key": "content", "type": "str"}, - "chunk_index": {"key": "chunkIndex", "type": "float"}, + "chunk_index": {"key": "chunkIndex", "type": "int"}, } - def __init__(self, *, content: Optional[str] = None, chunk_index: Optional[float] = None, **kwargs: Any) -> None: + def __init__(self, *, content: Optional[str] = None, chunk_index: Optional[int] = None, **kwargs: Any) -> None: """ :keyword content: File Content in base64 encoded format. :paramtype content: str :keyword chunk_index: Index of the uploaded chunk (Index starts at 0). - :paramtype chunk_index: float + :paramtype chunk_index: int """ super().__init__(**kwargs) self.content = content 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 00cbedb5a139..e6dfd621f375 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 @@ -8,23 +8,21 @@ from ._operations import Operations from ._services_operations import ServicesOperations +from ._service_classifications_no_subscription_operations import ServiceClassificationsNoSubscriptionOperations +from ._service_classifications_operations import ServiceClassificationsOperations +from ._problem_classifications_no_subscription_operations import ProblemClassificationsNoSubscriptionOperations 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 ._support_ticket_communications_no_subscription_operations import ( - SupportTicketCommunicationsNoSubscriptionOperations, -) from ._chat_transcripts_operations import ChatTranscriptsOperations -from ._support_ticket_chat_transcripts_no_subscription_operations import ( - SupportTicketChatTranscriptsNoSubscriptionOperations, -) 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 ._look_up_resource_id_operations import LookUpResourceIdOperations from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import @@ -33,19 +31,21 @@ __all__ = [ "Operations", "ServicesOperations", + "ServiceClassificationsNoSubscriptionOperations", + "ServiceClassificationsOperations", + "ProblemClassificationsNoSubscriptionOperations", "ProblemClassificationsOperations", "SupportTicketsOperations", "SupportTicketsNoSubscriptionOperations", "CommunicationsOperations", "CommunicationsNoSubscriptionOperations", - "SupportTicketCommunicationsNoSubscriptionOperations", "ChatTranscriptsOperations", - "SupportTicketChatTranscriptsNoSubscriptionOperations", "ChatTranscriptsNoSubscriptionOperations", "FileWorkspacesOperations", "FileWorkspacesNoSubscriptionOperations", "FilesOperations", "FilesNoSubscriptionOperations", + "LookUpResourceIdOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) _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 13c8b97053b2..007db00aa6dd 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Optional, TypeVar +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,6 +17,7 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.rest import HttpRequest @@ -34,11 +36,35 @@ _SERIALIZER.client_side_validation = False +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", "2023-06-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts") + path_format_arguments = { + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_get_request(support_ticket_name: str, chat_transcript_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,6 +107,86 @@ def __init__(self, *args, **kwargs): self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + @distributed_trace + def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.ChatTranscriptDetails"]: + """Lists all chat transcripts for a support ticket. + + :param support_ticket_name: Support ticket name. Required. + :type support_ticket_name: str + :return: An iterator like instance of either ChatTranscriptDetails or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + support_ticket_name=support_ticket_name, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ChatTranscriptsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + @distributed_trace def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any) -> _models.ChatTranscriptDetails: """Returns chatTranscript details for a no subscription support ticket. @@ -89,7 +195,6 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any :type support_ticket_name: str :param chat_transcript_name: ChatTranscript name. Required. :type chat_transcript_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ChatTranscriptDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -108,20 +213,19 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, chat_transcript_name=chat_transcript_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -134,10 +238,6 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" - } + return 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 e0b0d20ea693..3c571cb275d9 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 +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -40,7 +40,7 @@ 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -70,7 +70,7 @@ 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -120,7 +120,6 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.Cha :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ChatTranscriptDetails or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] @@ -143,16 +142,15 @@ def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.Cha def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -164,13 +162,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ChatTranscriptsListResult", pipeline_response) @@ -180,11 +178,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -197,10 +195,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts" - } - @distributed_trace def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any) -> _models.ChatTranscriptDetails: """Returns chatTranscript details for a support ticket under a subscription. @@ -209,7 +203,6 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any :type support_ticket_name: str :param chat_transcript_name: ChatTranscript name. Required. :type chat_transcript_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: ChatTranscriptDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -228,21 +221,20 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, chat_transcript_name=chat_transcript_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -255,10 +247,6 @@ def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any deserialized = self._deserialize("ChatTranscriptDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" - } + return 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 0f618fbe2759..7565f8d3cbe0 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -7,7 +7,8 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase -from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core.exceptions import ( ClientAuthenticationError, @@ -17,6 +18,7 @@ ResourceNotModifiedError, map_error, ) +from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod @@ -41,7 +43,7 @@ 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", "2022-09-01-preview")) + 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") @@ -66,11 +68,41 @@ def build_check_name_availability_request(support_ticket_name: str, **kwargs: An return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) +def build_list_request( + support_ticket_name: str, *, top: Optional[int] = None, filter: Optional[str] = None, **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")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications") + path_format_arguments = { + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + def build_get_request(support_ticket_name: str, communication_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +130,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", "2022-09-01-preview")) + 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") @@ -163,7 +195,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -173,7 +204,7 @@ def check_name_availability( def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: IO, + check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -184,11 +215,10 @@ def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -198,7 +228,7 @@ def check_name_availability( def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], + check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of @@ -207,13 +237,9 @@ def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -241,22 +267,21 @@ def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( support_ticket_name=support_ticket_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -269,13 +294,108 @@ def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized + return deserialized # type: ignore - check_name_availability.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" - } + @distributed_trace + def list( + self, support_ticket_name: str, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> Iterable["_models.CommunicationDetails"]: + """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. + + :param support_ticket_name: Support ticket name. Required. + :type support_ticket_name: str + :param top: The number of values to return in the collection. Default is 10 and max is 10. + Default value is None. + :type top: int + :param filter: The filter to apply on the operation. You can filter by communicationType and + createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate + supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the + CommunicationType and CreatedDate filters by Logical And ('and') operator. Default value is + None. + :type filter: str + :return: An iterator like instance of either CommunicationDetails or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = 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)) + cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) + + error_map = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_request( + support_ticket_name=support_ticket_name, + top=top, + filter=filter, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CommunicationsListResult", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) @distributed_trace def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) -> _models.CommunicationDetails: @@ -285,7 +405,6 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) :type support_ticket_name: str :param communication_name: Communication name. Required. :type communication_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -304,20 +423,19 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, communication_name=communication_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -330,19 +448,15 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore def _create_initial( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.CommunicationDetails]: error_map = { @@ -368,23 +482,22 @@ def _create_initial( else: _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, communication_name=communication_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -403,13 +516,9 @@ def _create_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) + return cls(pipeline_response, deserialized, response_headers) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -432,14 +541,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -451,7 +552,7 @@ def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: IO, + create_communication_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -463,18 +564,10 @@ def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: IO + :type create_communication_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -486,7 +579,7 @@ def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CommunicationDetails]: """Adds a new customer communication to an Azure support ticket. @@ -496,19 +589,9 @@ def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Is either a CommunicationDetails - type or a IO type. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + IO[bytes] :return: An instance of LROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -540,7 +623,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -552,14 +635,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CommunicationDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return LROPoller[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 40bf7862d513..c09dde9dca28 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 +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,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", "2022-09-01-preview")) + 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") @@ -81,7 +81,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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,7 @@ 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -146,7 +146,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", "2022-09-01-preview")) + 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") @@ -212,7 +212,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -222,7 +221,7 @@ def check_name_availability( def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: IO, + check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -233,11 +232,10 @@ def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -247,7 +245,7 @@ def check_name_availability( def check_name_availability( self, support_ticket_name: str, - check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], + check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of @@ -256,13 +254,9 @@ def check_name_availability( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -290,23 +284,22 @@ def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,13 +312,9 @@ def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" - } + return deserialized # type: ignore @distributed_trace def list( @@ -350,7 +339,6 @@ def list( CommunicationType and CreatedDate filters by Logical And ('and') operator. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.CommunicationDetails] @@ -373,18 +361,17 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, top=top, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -396,13 +383,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("CommunicationsListResult", pipeline_response) @@ -412,11 +399,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -429,10 +416,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications" - } - @distributed_trace def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) -> _models.CommunicationDetails: """Returns communication details for a support ticket. @@ -441,7 +424,6 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) :type support_ticket_name: str :param communication_name: Communication name. Required. :type communication_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CommunicationDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.CommunicationDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -460,21 +442,20 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, communication_name=communication_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -487,19 +468,15 @@ def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore def _create_initial( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.CommunicationDetails]: error_map = { @@ -525,7 +502,7 @@ def _create_initial( else: _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, communication_name=communication_name, subscription_id=self._config.subscription_id, @@ -533,16 +510,15 @@ def _create_initial( content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -557,13 +533,9 @@ def _create_initial( deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -586,14 +558,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -605,7 +569,7 @@ def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: IO, + create_communication_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -617,18 +581,10 @@ def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: IO + :type create_communication_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -640,7 +596,7 @@ def begin_create( self, support_ticket_name: str, communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO], + create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.CommunicationDetails]: """Adds a new customer communication to an Azure support ticket. @@ -650,19 +606,9 @@ def begin_create( :param communication_name: Communication name. Required. :type communication_name: str :param create_communication_parameters: Communication object. Is either a CommunicationDetails - type or a IO type. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + IO[bytes] :return: An instance of LROPoller that returns either CommunicationDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] @@ -694,7 +640,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("CommunicationDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -706,14 +652,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.CommunicationDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" - } + return LROPoller[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 fdc23cd7c008..ac691c145280 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -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", "2022-09-01-preview")) + 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -109,7 +109,6 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -128,19 +127,18 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -153,11 +151,9 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}"} + return deserialized # type: ignore @distributed_trace def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -165,7 +161,6 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa :param file_workspace_name: File workspace name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -184,19 +179,18 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, api_version=api_version, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -209,8 +203,6 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - create.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}"} + return 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 1c6f4f8f8873..aca8dd80f9bb 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -38,7 +38,7 @@ 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", "2022-09-01-preview")) + 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_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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -115,7 +115,6 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -134,20 +133,19 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -160,13 +158,9 @@ def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceD deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - } + return deserialized # type: ignore @distributed_trace def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: @@ -174,7 +168,6 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa :param file_workspace_name: File workspace name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileWorkspaceDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -193,20 +186,19 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -219,10 +211,6 @@ def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspa deserialized = self._deserialize("FileWorkspaceDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - } + return 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 5d34e425f787..40f2c95ac874 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -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", "2022-09-01-preview")) + 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", "2022-09-01-preview")) + 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", "2022-09-01-preview")) + 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,7 +124,7 @@ 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", "2022-09-01-preview")) + 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") @@ -175,7 +175,6 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.Fil :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileDetails or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.FileDetails] :raises ~azure.core.exceptions.HttpResponseError: @@ -197,15 +196,14 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.Fil def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( file_workspace_name=file_workspace_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -217,13 +215,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FilesListResult", pipeline_response) @@ -233,11 +231,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -250,8 +248,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files"} - @distributed_trace def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: """Returns details of a specific file in a work space. @@ -260,7 +256,6 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -279,20 +274,19 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, file_name=file_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -305,11 +299,9 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}"} + return deserialized # type: ignore @overload def create( @@ -332,7 +324,6 @@ def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -343,7 +334,7 @@ def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: IO, + create_file_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -355,11 +346,10 @@ def create( :param file_name: File name. Required. :type file_name: str :param create_file_parameters: Create file object. Required. - :type create_file_parameters: IO + :type create_file_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -370,7 +360,7 @@ def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: Union[_models.FileDetails, IO], + create_file_parameters: Union[_models.FileDetails, IO[bytes]], **kwargs: Any ) -> _models.FileDetails: """Creates a new file under a workspace. @@ -379,13 +369,9 @@ def create( :type file_workspace_name: str :param file_name: File name. Required. :type file_name: str - :param create_file_parameters: Create file object. Is either a FileDetails type or a IO type. - Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param create_file_parameters: Create file object. Is either a FileDetails type or a IO[bytes] + type. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO[bytes] :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -413,23 +399,22 @@ def create( else: _json = self._serialize.body(create_file_parameters, "FileDetails") - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, file_name=file_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -442,11 +427,9 @@ def create( deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}"} + return deserialized # type: ignore @overload def upload( # pylint: disable=inconsistent-return-statements @@ -469,7 +452,6 @@ def upload( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -480,7 +462,7 @@ def upload( # pylint: disable=inconsistent-return-statements self, file_workspace_name: str, file_name: str, - upload_file: IO, + upload_file: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -492,11 +474,10 @@ def upload( # pylint: disable=inconsistent-return-statements :param file_name: File Name. Required. :type file_name: str :param upload_file: UploadFile object. Required. - :type upload_file: IO + :type upload_file: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -504,7 +485,7 @@ def upload( # pylint: disable=inconsistent-return-statements @distributed_trace def upload( # pylint: disable=inconsistent-return-statements - self, file_workspace_name: str, file_name: str, upload_file: Union[_models.UploadFile, IO], **kwargs: Any + 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. @@ -512,12 +493,9 @@ def upload( # pylint: disable=inconsistent-return-statements :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :param upload_file: UploadFile object. Is either a UploadFile type or a IO type. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param upload_file: UploadFile object. Is either a UploadFile type or a IO[bytes] type. + Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -545,23 +523,22 @@ def upload( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(upload_file, "UploadFile") - request = build_upload_request( + _request = build_upload_request( file_workspace_name=file_workspace_name, file_name=file_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -572,6 +549,4 @@ def upload( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - upload.metadata = {"url": "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload"} + return cls(pipeline_response, None, {}) # type: ignore 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 45be8eb23b97..e8bead18e9e8 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 +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -41,7 +41,7 @@ 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -69,7 +69,7 @@ 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -98,7 +98,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", "2022-09-01-preview")) + 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") @@ -132,7 +132,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", "2022-09-01-preview")) + 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") @@ -185,7 +185,6 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.Fil :param file_workspace_name: File Workspace Name. Required. :type file_workspace_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FileDetails or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.FileDetails] :raises ~azure.core.exceptions.HttpResponseError: @@ -207,16 +206,15 @@ def list(self, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.Fil def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( file_workspace_name=file_workspace_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -228,13 +226,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("FilesListResult", pipeline_response) @@ -244,11 +242,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -261,10 +259,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files" - } - @distributed_trace def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: """Returns details of a specific file in a work space. @@ -273,7 +267,6 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -292,21 +285,20 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( file_workspace_name=file_workspace_name, file_name=file_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -319,13 +311,9 @@ def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _model deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" - } + return deserialized # type: ignore @overload def create( @@ -348,7 +336,6 @@ def create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -359,7 +346,7 @@ def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: IO, + create_file_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -371,11 +358,10 @@ def create( :param file_name: File name. Required. :type file_name: str :param create_file_parameters: Create file object. Required. - :type create_file_parameters: IO + :type create_file_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -386,7 +372,7 @@ def create( self, file_workspace_name: str, file_name: str, - create_file_parameters: Union[_models.FileDetails, IO], + create_file_parameters: Union[_models.FileDetails, IO[bytes]], **kwargs: Any ) -> _models.FileDetails: """Creates a new file under a workspace for the specified subscription. @@ -395,13 +381,9 @@ def create( :type file_workspace_name: str :param file_name: File name. Required. :type file_name: str - :param create_file_parameters: Create file object. Is either a FileDetails type or a IO type. - Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param create_file_parameters: Create file object. Is either a FileDetails type or a IO[bytes] + type. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails or IO[bytes] :return: FileDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.FileDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -429,7 +411,7 @@ def create( else: _json = self._serialize.body(create_file_parameters, "FileDetails") - request = build_create_request( + _request = build_create_request( file_workspace_name=file_workspace_name, file_name=file_name, subscription_id=self._config.subscription_id, @@ -437,16 +419,15 @@ def create( content_type=content_type, json=_json, content=_content, - template_url=self.create.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -459,13 +440,9 @@ def create( deserialized = self._deserialize("FileDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" - } + return deserialized # type: ignore @overload def upload( # pylint: disable=inconsistent-return-statements @@ -488,7 +465,6 @@ def upload( # pylint: disable=inconsistent-return-statements :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -499,7 +475,7 @@ def upload( # pylint: disable=inconsistent-return-statements self, file_workspace_name: str, file_name: str, - upload_file: IO, + upload_file: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -511,11 +487,10 @@ def upload( # pylint: disable=inconsistent-return-statements :param file_name: File Name. Required. :type file_name: str :param upload_file: UploadFile object. Required. - :type upload_file: IO + :type upload_file: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -523,7 +498,7 @@ def upload( # pylint: disable=inconsistent-return-statements @distributed_trace def upload( # pylint: disable=inconsistent-return-statements - self, file_workspace_name: str, file_name: str, upload_file: Union[_models.UploadFile, IO], **kwargs: Any + 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. @@ -531,12 +506,9 @@ def upload( # pylint: disable=inconsistent-return-statements :type file_workspace_name: str :param file_name: File Name. Required. :type file_name: str - :param upload_file: UploadFile object. Is either a UploadFile type or a IO type. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + :param upload_file: UploadFile object. Is either a UploadFile type or a IO[bytes] type. + Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile or IO[bytes] :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -564,7 +536,7 @@ def upload( # pylint: disable=inconsistent-return-statements else: _json = self._serialize.body(upload_file, "UploadFile") - request = build_upload_request( + _request = build_upload_request( file_workspace_name=file_workspace_name, file_name=file_name, subscription_id=self._config.subscription_id, @@ -572,16 +544,15 @@ def upload( # pylint: disable=inconsistent-return-statements content_type=content_type, json=_json, content=_content, - template_url=self.upload.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -592,8 +563,4 @@ def upload( # pylint: disable=inconsistent-return-statements raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: - return cls(pipeline_response, None, {}) - - upload.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" - } + return cls(pipeline_response, None, {}) # type: ignore 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..65227943cb0c --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_look_up_resource_id_operations.py @@ -0,0 +1,186 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("LookUpResourceIdResponse", pipeline_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 14dc4473a414..03f2baf6d113 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -78,7 +78,6 @@ def __init__(self, *args, **kwargs): def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """This lists all the available Microsoft Support REST API operations. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Operation or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: @@ -100,14 +99,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -119,13 +117,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("OperationsListResult", pipeline_response) @@ -135,11 +133,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -151,5 +149,3 @@ def get_next(next_link=None): return pipeline_response return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Support/operations"} 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..a0cab0deecfe --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_no_subscription_operations.py @@ -0,0 +1,211 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProblemClassificationsClassificationOutput", pipeline_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 eb10c878cc82..b3b965a5f674 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -6,7 +6,8 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from io import IOBase +from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload import urllib.parse from azure.core.exceptions import ( @@ -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", + ) # pylint: disable=line-too-long + 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +98,7 @@ 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -107,6 +141,134 @@ def __init__(self, *args, **kwargs): 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") + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ProblemClassificationsClassificationOutput", pipeline_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"]: """Lists all the problem classifications (categories) available for a specific Azure service. @@ -116,7 +278,6 @@ def list(self, service_name: str, **kwargs: Any) -> Iterable["_models.ProblemCla :param service_name: Name of the Azure service for which the problem classifications need to be retrieved. Required. :type service_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProblemClassification or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ProblemClassification] @@ -139,15 +300,14 @@ def list(self, service_name: str, **kwargs: Any) -> Iterable["_models.ProblemCla def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( service_name=service_name, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -159,13 +319,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ProblemClassificationsListResult", pipeline_response) @@ -175,11 +335,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -192,17 +352,15 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/services/{serviceName}/problemClassifications"} - @distributed_trace 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: ProblemClassification or the result of cls(response) :rtype: ~azure.mgmt.support.models.ProblemClassification :raises ~azure.core.exceptions.HttpResponseError: @@ -221,20 +379,19 @@ def get(self, service_name: str, problem_classification_name: str, **kwargs: Any api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.ProblemClassification] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( service_name=service_name, problem_classification_name=problem_classification_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -247,10 +404,6 @@ def get(self, service_name: str, problem_classification_name: str, **kwargs: Any deserialized = self._deserialize("ProblemClassification", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}" - } + return 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..83893655a354 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_no_subscription_operations.py @@ -0,0 +1,180 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceClassificationOutput", pipeline_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..a8a651b06f44 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_service_classifications_operations.py @@ -0,0 +1,186 @@ +# pylint: disable=too-many-lines,too-many-statements +# 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 io import IOBase +from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer +from .._vendor import _convert_request + +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 = 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") + + @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 = { + 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 = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ServiceClassificationOutput", pipeline_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 b6eb336618a5..5d3d18cf88c3 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -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", "2022-09-01-preview")) + 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -108,7 +108,6 @@ def list(self, **kwargs: Any) -> Iterable["_models.Service"]: programmatically for support ticket creation. This practice ensures that you always have the most recent set of service and problem classification Ids. - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either Service or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.Service] :raises ~azure.core.exceptions.HttpResponseError: @@ -130,14 +129,13 @@ def list(self, **kwargs: Any) -> Iterable["_models.Service"]: def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -149,13 +147,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("ServicesListResult", pipeline_response) @@ -165,11 +163,11 @@ def extract_data(pipeline_response): return None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -182,15 +180,13 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/services"} - @distributed_trace 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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: Service or the result of cls(response) :rtype: ~azure.mgmt.support.models.Service :raises ~azure.core.exceptions.HttpResponseError: @@ -209,19 +205,18 @@ def get(self, service_name: str, **kwargs: Any) -> _models.Service: api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Service] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( service_name=service_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -234,8 +229,6 @@ def get(self, service_name: str, **kwargs: Any) -> _models.Service: deserialized = self._deserialize("Service", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - get.metadata = {"url": "/providers/Microsoft.Support/services/{serviceName}"} + return deserialized # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_chat_transcripts_no_subscription_operations.py deleted file mode 100644 index c27caec6c307..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_chat_transcripts_no_subscription_operations.py +++ /dev/null @@ -1,164 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -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", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts") - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SupportTicketChatTranscriptsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`support_ticket_chat_transcripts_no_subscription` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, support_ticket_name: str, **kwargs: Any) -> Iterable["_models.ChatTranscriptDetails"]: - """Lists all chat transcripts for a support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ChatTranscriptDetails or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.ChatTranscriptsListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - support_ticket_name=support_ticket_name, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ChatTranscriptsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts"} diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_communications_no_subscription_operations.py deleted file mode 100644 index 53f2e3ce0510..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_ticket_communications_no_subscription_operations.py +++ /dev/null @@ -1,189 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - support_ticket_name: str, *, top: Optional[int] = None, filter: Optional[str] = None, **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", "2022-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications") - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class SupportTicketCommunicationsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`support_ticket_communications_no_subscription` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, support_ticket_name: str, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.CommunicationDetails"]: - """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. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param top: The number of values to return in the collection. Default is 10 and max is 10. - Default value is None. - :type top: int - :param filter: The filter to apply on the operation. You can filter by communicationType and - createdDate properties. CommunicationType supports Equals ('eq') operator and createdDate - supports Greater Than ('gt') and Greater Than or Equals ('ge') operators. You may combine the - CommunicationType and CreatedDate filters by Logical And ('and') operator. Default value is - None. - :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CommunicationDetails or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.CommunicationDetails] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = 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)) - cls: ClsType[_models.CommunicationsListResult] = kwargs.pop("cls", None) - - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - request = build_list_request( - support_ticket_name=support_ticket_name, - top=top, - filter=filter, - api_version=api_version, - template_url=self.list.metadata["url"], - headers=_headers, - params=_params, - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) - request.method = "GET" - return request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CommunicationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - list.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications"} 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 d6c16e39d377..a726678cb095 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,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", "2022-09-01-preview")) + 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 +65,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", "2022-09-01-preview")) + 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 +88,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", "2022-09-01-preview")) + 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 +112,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", "2022-09-01-preview")) + 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 +139,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", "2022-09-01-preview")) + 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") @@ -197,7 +197,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -205,17 +204,16 @@ def check_name_availability( @overload def check_name_availability( - self, check_name_availability_input: IO, *, content_type: str = "application/json", **kwargs: Any + self, check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -223,19 +221,15 @@ def check_name_availability( @distributed_trace def check_name_availability( - self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **kwargs: Any + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -263,21 +257,20 @@ def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -290,11 +283,9 @@ def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - check_name_availability.metadata = {"url": "/providers/Microsoft.Support/checkNameAvailability"} + return deserialized # type: ignore @distributed_trace def list( @@ -319,7 +310,6 @@ def list( :code:`CreatedDate` filter, the supported operators are 'gt' and 'ge'. When using both filters, combine them using the logical 'AND'. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.SupportTicketDetails] @@ -342,16 +332,15 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( top=top, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -363,13 +352,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SupportTicketsListResult", pipeline_response) @@ -379,11 +368,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -396,8 +385,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/providers/Microsoft.Support/supportTickets"} - @distributed_trace def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: """Gets details for a specific support ticket. Support ticket data is available for 18 months @@ -406,7 +393,6 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -425,19 +411,18 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -450,11 +435,9 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return deserialized # type: ignore @overload def update( @@ -478,7 +461,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -488,7 +470,7 @@ def update( def update( self, support_ticket_name: str, - update_support_ticket: IO, + update_support_ticket: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -502,11 +484,10 @@ def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: IO + :type update_support_ticket: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -514,7 +495,10 @@ def update( @distributed_trace def update( - self, support_ticket_name: str, update_support_ticket: Union[_models.UpdateSupportTicket, IO], **kwargs: Any + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, IO[bytes]], + **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 @@ -525,12 +509,8 @@ def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - or a IO type. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO[bytes] :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -558,22 +538,21 @@ def update( else: _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - request = build_update_request( + _request = build_update_request( support_ticket_name=support_ticket_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -586,16 +565,14 @@ def update( deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - update.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return deserialized # type: ignore def _create_initial( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.SupportTicketDetails]: error_map = { @@ -621,22 +598,21 @@ def _create_initial( else: _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -655,11 +631,9 @@ def _create_initial( response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) if cls: - return cls(pipeline_response, deserialized, response_headers) - - return deserialized + return cls(pipeline_response, deserialized, response_headers) # type: ignore - _create_initial.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return deserialized # type: ignore @overload def begin_create( @@ -690,14 +664,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -708,7 +674,7 @@ def begin_create( def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: IO, + create_support_ticket_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -729,18 +695,10 @@ def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Required. - :type create_support_ticket_parameters: IO + :type create_support_ticket_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -751,7 +709,7 @@ def begin_create( def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Billing, and Subscription Management issues. Learn the @@ -770,19 +728,9 @@ def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Is either a - SupportTicketDetails type or a IO type. Required. - :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + IO[bytes] :return: An instance of LROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -813,7 +761,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -825,12 +773,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.SupportTicketDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = {"url": "/providers/Microsoft.Support/supportTickets/{supportTicketName}"} + return LROPoller[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 51ea688108ae..05a5d8bcea41 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,4 @@ -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines,too-many-statements # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -43,7 +43,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", "2022-09-01-preview")) + 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 +74,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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ 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", "2022-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -129,7 +129,7 @@ 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", "2022-09-01-preview")) + 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") @@ -159,7 +159,7 @@ 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", "2022-09-01-preview")) + 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") @@ -220,7 +220,6 @@ def check_name_availability( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -228,17 +227,16 @@ def check_name_availability( @overload def check_name_availability( - self, check_name_availability_input: IO, *, content_type: str = "application/json", **kwargs: Any + self, check_name_availability_input: IO[bytes], *, content_type: str = "application/json", **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Required. - :type check_name_availability_input: IO + :type check_name_availability_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 - :keyword callable cls: A custom type or function that will be passed the direct response :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -246,19 +244,15 @@ def check_name_availability( @distributed_trace def check_name_availability( - self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO], **kwargs: Any + self, check_name_availability_input: Union[_models.CheckNameAvailabilityInput, IO[bytes]], **kwargs: Any ) -> _models.CheckNameAvailabilityOutput: """Check the availability of a resource name. This API should be used to check the uniqueness of the name for support ticket creation for the selected subscription. :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput - type or a IO type. Required. + type or a IO[bytes] type. Required. :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + IO[bytes] :return: CheckNameAvailabilityOutput or the result of cls(response) :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput :raises ~azure.core.exceptions.HttpResponseError: @@ -286,22 +280,21 @@ def check_name_availability( else: _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - request = build_check_name_availability_request( + _request = build_check_name_availability_request( subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.check_name_availability.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -314,13 +307,9 @@ def check_name_availability( deserialized = self._deserialize("CheckNameAvailabilityOutput", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - check_name_availability.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability" - } + return deserialized # type: ignore @distributed_trace def list( @@ -343,7 +332,6 @@ def list( Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. Default value is None. :type filter: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.SupportTicketDetails] @@ -366,17 +354,16 @@ def list( def prepare_request(next_link=None): if not next_link: - request = build_list_request( + _request = build_list_request( subscription_id=self._config.subscription_id, top=top, filter=filter, api_version=api_version, - template_url=self.list.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) else: # make call to next link with the client's api-version @@ -388,13 +375,13 @@ def prepare_request(next_link=None): } ) _next_request_params["api-version"] = self._config.api_version - request = HttpRequest( + _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 + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request def extract_data(pipeline_response): deserialized = self._deserialize("SupportTicketsListResult", pipeline_response) @@ -404,11 +391,11 @@ def extract_data(pipeline_response): return deserialized.next_link or None, iter(list_of_elem) def get_next(next_link=None): - request = prepare_request(next_link) + _request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -421,8 +408,6 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) - list.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets"} - @distributed_trace def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: """Get ticket details for an Azure subscription. Support ticket data is available for 18 months @@ -431,7 +416,6 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -450,20 +434,19 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) - request = build_get_request( + _request = build_get_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, - template_url=self.get.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -476,13 +459,9 @@ def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketD deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - get.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return deserialized # type: ignore @overload def update( @@ -506,7 +485,6 @@ def update( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -516,7 +494,7 @@ def update( def update( self, support_ticket_name: str, - update_support_ticket: IO, + update_support_ticket: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -530,11 +508,10 @@ def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: IO + :type update_support_ticket: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -542,7 +519,10 @@ def update( @distributed_trace def update( - self, support_ticket_name: str, update_support_ticket: Union[_models.UpdateSupportTicket, IO], **kwargs: Any + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, IO[bytes]], + **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 @@ -553,12 +533,8 @@ def update( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - or a IO type. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or IO[bytes] :return: SupportTicketDetails or the result of cls(response) :rtype: ~azure.mgmt.support.models.SupportTicketDetails :raises ~azure.core.exceptions.HttpResponseError: @@ -586,23 +562,22 @@ def update( else: _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - request = build_update_request( + _request = build_update_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self.update.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -615,18 +590,14 @@ def update( deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) - - return deserialized + return cls(pipeline_response, deserialized, {}) # type: ignore - update.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return deserialized # type: ignore def _create_initial( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> Optional[_models.SupportTicketDetails]: error_map = { @@ -652,23 +623,22 @@ def _create_initial( else: _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - request = build_create_request( + _request = build_create_request( support_ticket_name=support_ticket_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, - template_url=self._create_initial.metadata["url"], headers=_headers, params=_params, ) - request = _convert_request(request) - request.url = self._client.format_url(request.url) + _request = _convert_request(_request) + _request.url = self._client.format_url(_request.url) _stream = False pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - request, stream=_stream, **kwargs + _request, stream=_stream, **kwargs ) response = pipeline_response.http_response @@ -683,13 +653,9 @@ def _create_initial( deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - _create_initial.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return deserialized # type: ignore @overload def begin_create( @@ -727,14 +693,6 @@ def begin_create( :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -745,7 +703,7 @@ def begin_create( def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: IO, + create_support_ticket_parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any @@ -773,18 +731,10 @@ def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Required. - :type create_support_ticket_parameters: IO + :type create_support_ticket_parameters: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. :return: An instance of LROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -795,7 +745,7 @@ def begin_create( def begin_create( self, support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO], + create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], **kwargs: Any ) -> LROPoller[_models.SupportTicketDetails]: """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, @@ -821,19 +771,9 @@ def begin_create( :param support_ticket_name: Support ticket name. Required. :type support_ticket_name: str :param create_support_ticket_parameters: Support ticket request payload. Is either a - SupportTicketDetails type or a IO type. Required. - :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or IO - :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. - Default value is None. - :paramtype content_type: str - :keyword callable cls: A custom type or function that will be passed the direct response - :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this - operation to not poll, or pass in your own initialized polling object for a personal polling - strategy. - :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + IO[bytes] :return: An instance of LROPoller that returns either SupportTicketDetails or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] @@ -864,7 +804,7 @@ def begin_create( def get_long_running_output(pipeline_response): deserialized = self._deserialize("SupportTicketDetails", pipeline_response) if cls: - return cls(pipeline_response, deserialized, {}) + return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized if polling is True: @@ -876,14 +816,12 @@ def get_long_running_output(pipeline_response): else: polling_method = polling if cont_token: - return LROPoller.from_continuation_token( + return LROPoller[_models.SupportTicketDetails].from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - begin_create.metadata = { - "url": "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - } + return LROPoller[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) 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 e2b50e44fa50..903dcae3326e 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 @@ -6,7 +6,10 @@ # 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 """ @@ -35,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 0e46205443ea..11efa11be966 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 edd181f0e145..5a97d58aed6e 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 fe731a3d8e25..2e74fd5444af 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 @@ -6,7 +6,10 @@ # 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 """ @@ -35,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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..61b930d1476d --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications.py @@ -0,0 +1,44 @@ +# 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 typing import Any, IO, Union + +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..ba0e018a9324 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications_for_subscription.py @@ -0,0 +1,47 @@ +# 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 typing import Any, IO, Union + +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..0a24cdb59360 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_services.py @@ -0,0 +1,46 @@ +# 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 typing import Any, IO, Union + +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..868c20fee582 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_services_for_subscription.py @@ -0,0 +1,46 @@ +# 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 typing import Any, IO, Union + +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 75c76628cbdc..b0e56026201a 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 @@ -6,7 +6,10 @@ # 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 """ @@ -62,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 0bb1fcd3d93d..b5e25d855a88 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 @@ -6,7 +6,10 @@ # 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 """ @@ -65,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 322b4050fee9..d3cb05e1a0e3 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 @@ -6,7 +6,10 @@ # 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 """ @@ -62,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 ea05a6793d3c..dd924b43ad5b 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 @@ -6,7 +6,10 @@ # 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 """ @@ -62,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 b5707367dd0f..6d12eae8b136 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 @@ -6,7 +6,10 @@ # 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 """ @@ -60,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 f5104cfb8a6b..7bf0397a4151 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 @@ -6,7 +6,10 @@ # 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 """ @@ -55,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 16e3b37cf19c..0a2a5b5b954c 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 @@ -6,7 +6,10 @@ # 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 """ @@ -55,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 30e1f23f638f..5c16eeb84c2a 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 @@ -6,7 +6,10 @@ # 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 """ @@ -59,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 fa28d3b08ae3..70c2eb72f0f9 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_file.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_file.py @@ -6,7 +6,10 @@ # 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 """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 b5d597cbea98..99828b27b038 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 @@ -6,7 +6,10 @@ # 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 """ @@ -37,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 b579c570cb1c..dacb03fb8fa7 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 218d4eb42941..7359040f6b38 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 d80c3c214707..5379d9b5fd13 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 @@ -6,7 +6,10 @@ # 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 """ @@ -53,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 a38d33cd8f24..03790b237a1d 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 @@ -6,7 +6,10 @@ # 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 """ @@ -65,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 ccd4666ee242..89d84b879739 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 @@ -6,7 +6,10 @@ # 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 """ @@ -60,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 eceaa7ca1450..4e90281e38e1 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 @@ -6,7 +6,10 @@ # 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 """ @@ -43,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 6ff77e1d27e6..cc79e903da84 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 @@ -6,7 +6,10 @@ # 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 """ @@ -62,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 f3aeaf1c4c6a..204949ce54d7 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 @@ -6,7 +6,10 @@ # 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 """ @@ -60,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 3ccd3a2622bb..a10f864dea0f 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 @@ -6,7 +6,10 @@ # 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 """ @@ -62,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 12cbf1865c32..6e5b01af4ab5 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 @@ -6,7 +6,10 @@ # 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 """ @@ -60,6 +63,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 916d8725ee14..153cb86b3aa2 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 @@ -6,7 +6,10 @@ # 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 """ @@ -63,6 +66,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 db74f6871829..218e39c8da5b 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 @@ -6,7 +6,10 @@ # 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 """ @@ -55,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 7c12ef481d06..1c852bb4aeb4 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 @@ -6,7 +6,10 @@ # 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 """ @@ -55,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 73bfa9b810ae..99463a5748e3 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 @@ -6,7 +6,10 @@ # 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 """ @@ -43,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 b5c9c2b926bb..f92509ada07c 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 @@ -6,7 +6,10 @@ # 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 """ @@ -58,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 e22008803358..f4f2fb9a927b 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 @@ -6,7 +6,10 @@ # 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 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 dbf4f87cc9ea..1f72d273b314 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 c0fe2b66e85e..9dfa2b479f6c 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 8313e2b6c856..52fd0a0752e7 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 56b17c62b55d..acbcc4dba36e 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 9c0344687d29..ac94e886476b 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 978e11fd0212..cb91d134da4a 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 5ac25bf5001b..39f55930f5ad 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 0ed9ec3e6359..c7cebf085d95 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_service.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_service.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 89a5518bf946..c82bbaa42b01 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 693155f986a9..abde23002e4e 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -35,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 dbb90c4200bc..f5c7c88e618e 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 32a271c87647..1be4409a0f53 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 418a6cd01942..a91fc1fdcd7f 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 3d816186d59d..76f73e9757c5 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -29,13 +30,13 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.support_ticket_chat_transcripts_no_subscription.list( + response = client.chat_transcripts_no_subscription.list( support_ticket_name="testticket", ) for item in response: print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 896a6eff899d..87bbaabba1bf 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 219de58cc4ae..fc495e5a171b 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -29,13 +30,13 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.support_ticket_communications_no_subscription.list( + response = client.communications_no_subscription.list( support_ticket_name="testticket", ) for item in response: print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 81644afb8101..a871fa85c550 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 c11efeac124e..cecd2e14e0c4 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 9e49e7d96f09..4218b7ed1d07 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_operations.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_operations.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 72e6b7725ef3..3bbcea826b82 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 76967bec1e25..1edc17c8c62d 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_services.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_services.py @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 faefa0bb00b4..6def4bac88e7 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 e7f01c053a16..4e88bb96f616 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 9acb5dcec478..13b8ea5036af 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 eac529ef60d1..72aba7d0ca1f 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 003ce89db5a6..c31ab5dc112d 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 717ea38e350e..aab0395c5367 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 851960efd8c1..cb18f361e92b 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 589bf05ad2c5..058fd2e63b09 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 005e39071b6a..5b96af13f503 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 a56d915a7c6b..03ecd190637e 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 86edf24d9469..3a9ad5c19e13 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 ceed3d0b00e5..c0b4d090170b 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 940fb04ee122..1735fefabe31 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 676c37f4e708..2e69f159baaf 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -34,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 483870b17f17..ad559fdbd2b3 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 219535c62f2d..ad83bd6bf1d8 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -36,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 1a2a9a0aa71a..1ff1de42efd5 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -29,13 +30,13 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.support_ticket_communications_no_subscription.list( + response = client.communications_no_subscription.list( support_ticket_name="testticket", ) for item in response: print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 0292e8267e63..b5684a0a9a8a 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 @@ -7,6 +7,7 @@ # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential + from azure.mgmt.support import MicrosoftSupport """ @@ -29,13 +30,13 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.support_ticket_communications_no_subscription.list( + response = client.communications_no_subscription.list( support_ticket_name="testticket", ) for item in response: print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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..f80a4339669d --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/look_up_resource_id.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, IO, Union + +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 15268c2fa34c..f9414e3dd26a 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 81f28fdcfed2..6c13c697117c 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 50f3e6a6ed1f..0243e6c6af16 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 @@ -6,7 +6,10 @@ # 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 """ @@ -48,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 e29084535dac..24e09578758f 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 @@ -6,7 +6,10 @@ # 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 """ @@ -48,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 d892d3c8489d..d8c997029f33 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 9c1d92084c07..27356da87a16 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 02452f03e8d5..e32caf225b1e 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 7bcd06b2095d..fc1adfbcaa0e 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 @@ -6,7 +6,10 @@ # 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,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 2aa2d34ccb77..0ad2b26e2e62 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/upload_file.py +++ b/sdk/support/azure-mgmt-support/generated_samples/upload_file.py @@ -6,7 +6,10 @@ # 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 +42,6 @@ def main(): ) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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 95ca5376f6f4..98e1b0af9bba 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 @@ -6,7 +6,10 @@ # 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 +42,6 @@ def main(): ) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/preview/2022-09-01-preview/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/setup.py b/sdk/support/azure-mgmt-support/setup.py index eda1d1890093..6e2d26f7b9ad 100644 --- a/sdk/support/azure-mgmt-support/setup.py +++ b/sdk/support/azure-mgmt-support/setup.py @@ -53,11 +53,11 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "License :: OSI Approved :: MIT License", ], zip_safe=False, @@ -74,10 +74,9 @@ "pytyped": ["py.typed"], }, install_requires=[ - "isodate<1.0.0,>=0.6.1", - "azure-common~=1.1", - "azure-mgmt-core>=1.3.2,<2.0.0", - "typing-extensions>=4.3.0; python_version<'3.8.0'", + "isodate>=0.6.1", + "azure-common>=1.1", + "azure-mgmt-core>=1.3.2", ], - python_requires=">=3.7", + python_requires=">=3.8", )