diff --git a/sdk/support/azure-mgmt-support/CHANGELOG.md b/sdk/support/azure-mgmt-support/CHANGELOG.md index c830866fb13e..d5c692580f92 100644 --- a/sdk/support/azure-mgmt-support/CHANGELOG.md +++ b/sdk/support/azure-mgmt-support/CHANGELOG.md @@ -1,5 +1,54 @@ # Release History +## 8.0.0 (2026-07-06) + +### Features Added + + - Model `CommunicationDetails` added property `system_data` + - Model `Operation` added property `is_data_action` + - Model `Operation` added property `origin` + - Model `Operation` added property `action_type` + - Model `ProblemClassification` added property `system_data` + - Model `Service` added property `system_data` + - Model `SupportTicketDetails` added property `system_data` + - Model `UpdateSupportTicket` added property `direct_connect_escalation` + - Added enum `ActionType` + - Added enum `ChatConversationStatus` + - Added model `ClassificationService` + - Added model `DirectConnectEscalation` + - Added enum `EscalationStatus` + - Added model `LookUpResourceIdRequest` + - Added model `LookUpResourceIdResponse` + - Added enum `Origin` + - Added model `ProblemClassificationsClassificationInput` + - Added model `ProblemClassificationsClassificationOutput` + - Added model `ProblemClassificationsClassificationResult` + - Added model `ServiceClassificationAnswer` + - Added model `ServiceClassificationOutput` + - Added model `ServiceClassificationRequest` + - Added enum `SupportChannel` + - Operation group `SupportTicketsOperations` added method `look_up_resource_id` + - Added operation group `ClassifyProblemsNoSubscriptionOperations` + - Added operation group `ClassifyProblemsOperations` + - Added operation group `ClassifyServicesNoSubscriptionOperations` + - Added operation group `ClassifyServicesOperations` + +### Breaking Changes + + - This version introduces new hybrid models which have dual dictionary and model nature. Please follow https://aka.ms/azsdk/python/migrate/hybrid-models for migration. + - Renamed client `MicrosoftSupport` to `SupportMgmtClient` + - Model `ChatTranscriptDetails` moved instance variable `messages` and `start_time` under property `properties` whose type is `ChatTranscriptDetailsProperties` + - Model `CommunicationDetails` moved instance variable `communication_type`, `communication_direction`, `sender`, `subject`, `body` and `created_date` under property `properties` whose type is `CommunicationDetailsProperties` + - Model `FileDetails` moved instance variable `created_on`, `chunk_size`, `file_size` and `number_of_chunks` under property `properties` whose type is `FileDetailsProperties` + - Model `FileWorkspaceDetails` moved instance variable `created_on` and `expiration_time` under property `properties` whose type is `FileWorkspaceDetailsProperties` + - Model `ProblemClassification` moved instance variable `display_name` and `secondary_consent_enabled` under property `properties` whose type is `ProblemClassificationProperties` + - Model `Service` moved instance variable `display_name` and `resource_types` under property `properties` whose type is `ServiceProperties` + - Model `SupportTicketDetails` moved instance variable `support_ticket_id`, `description`, `problem_classification_id`, `problem_classification_display_name`, `severity`, `enrollment_id`, `require24_x7_response`, `advanced_diagnostic_consent`, `problem_scoping_questions`, `support_plan_id`, `contact_details`, `service_level_agreement`, `support_engineer`, `support_plan_type`, `support_plan_display_name`, `title`, `problem_start_time`, `service_id`, `service_display_name`, `status`, `created_date`, `modified_date`, `file_workspace_name`, `is_temporary_ticket`, `technical_ticket_details`, `quota_ticket_details` and `secondary_consent` under property `properties` whose type is `SupportTicketDetailsProperties` + +### Other Changes + + - Deleted model `ChatTranscriptsListResult`/`CommunicationsListResult`/`FilesListResult`/`OperationsListResult`/`ProblemClassificationsListResult`/`ServicesListResult`/`SupportTicketsListResult`/`TranscriptContentType` which actually were not used by SDK users + ## 7.0.0 (2024-04-22) ### Features Added diff --git a/sdk/support/azure-mgmt-support/MANIFEST.in b/sdk/support/azure-mgmt-support/MANIFEST.in index 52d8e31566d1..29aa3862e281 100644 --- a/sdk/support/azure-mgmt-support/MANIFEST.in +++ b/sdk/support/azure-mgmt-support/MANIFEST.in @@ -1,8 +1,7 @@ -include _meta.json -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/support/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/support/azure-mgmt-support/README.md b/sdk/support/azure-mgmt-support/README.md index bf0a6ac456dc..c12b449383a2 100644 --- a/sdk/support/azure-mgmt-support/README.md +++ b/sdk/support/azure-mgmt-support/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Support Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.10+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.8+ is required to use this package. +- Python 3.10+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables. +By default, [Microsoft Entra](https://learn.microsoft.com/entra/fundamentals/what-is-entra) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. @@ -36,11 +36,11 @@ With above configuration, client can be authenticated by following code: ```python from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient import os sub_id = os.getenv("AZURE_SUBSCRIPTION_ID") -client = MicrosoftSupport(credential=DefaultAzureCredential(), subscription_id=sub_id) +client = SupportMgmtClient(credential=DefaultAzureCredential(), subscription_id=sub_id) ``` ## Examples diff --git a/sdk/support/azure-mgmt-support/_meta.json b/sdk/support/azure-mgmt-support/_meta.json deleted file mode 100644 index ebfe2dc6b38c..000000000000 --- a/sdk/support/azure-mgmt-support/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "665e7c3b6f26b148b3c05e55602621bc293cc0a4", - "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.9.7", - "use": [ - "@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.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/_metadata.json b/sdk/support/azure-mgmt-support/_metadata.json new file mode 100644 index 000000000000..f618382d5336 --- /dev/null +++ b/sdk/support/azure-mgmt-support/_metadata.json @@ -0,0 +1,11 @@ +{ + "apiVersion": "2026-07-01", + "apiVersions": { + "Microsoft.Support": "2026-07-01" + }, + "commit": "3de4ed97d8bf726aa7fb8dea311a5a7d5ec59730", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "typespec_src": "specification/support/resource-manager/Microsoft.Support/Support", + "emitterVersion": "0.63.2", + "httpClientPythonVersion": "^0.34.0" +} \ No newline at end of file diff --git a/sdk/support/azure-mgmt-support/api.md b/sdk/support/azure-mgmt-support/api.md new file mode 100644 index 000000000000..4d85ede1ecc0 --- /dev/null +++ b/sdk/support/azure-mgmt-support/api.md @@ -0,0 +1,3343 @@ +```py +namespace azure.mgmt.support + + class azure.mgmt.support.SupportMgmtClient: implements ContextManager + chat_transcripts: ChatTranscriptsOperations + chat_transcripts_no_subscription: ChatTranscriptsNoSubscriptionOperations + classify_problems: ClassifyProblemsOperations + classify_problems_no_subscription: ClassifyProblemsNoSubscriptionOperations + classify_services: ClassifyServicesOperations + classify_services_no_subscription: ClassifyServicesNoSubscriptionOperations + communications: CommunicationsOperations + communications_no_subscription: CommunicationsNoSubscriptionOperations + file_workspaces: FileWorkspacesOperations + file_workspaces_no_subscription: FileWorkspacesNoSubscriptionOperations + files: FilesOperations + files_no_subscription: FilesNoSubscriptionOperations + operations: Operations + problem_classifications: ProblemClassificationsOperations + services: ServicesOperations + support_tickets: SupportTicketsOperations + support_tickets_no_subscription: SupportTicketsNoSubscriptionOperations + + def __init__( + self, + credential: TokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> HttpResponse: ... + + +namespace azure.mgmt.support.aio + + class azure.mgmt.support.aio.SupportMgmtClient: implements AsyncContextManager + chat_transcripts: ChatTranscriptsOperations + chat_transcripts_no_subscription: ChatTranscriptsNoSubscriptionOperations + classify_problems: ClassifyProblemsOperations + classify_problems_no_subscription: ClassifyProblemsNoSubscriptionOperations + classify_services: ClassifyServicesOperations + classify_services_no_subscription: ClassifyServicesNoSubscriptionOperations + communications: CommunicationsOperations + communications_no_subscription: CommunicationsNoSubscriptionOperations + file_workspaces: FileWorkspacesOperations + file_workspaces_no_subscription: FileWorkspacesNoSubscriptionOperations + files: FilesOperations + files_no_subscription: FilesNoSubscriptionOperations + operations: Operations + problem_classifications: ProblemClassificationsOperations + services: ServicesOperations + support_tickets: SupportTicketsOperations + support_tickets_no_subscription: SupportTicketsNoSubscriptionOperations + + def __init__( + self, + credential: AsyncTokenCredential, + subscription_id: str, + base_url: Optional[str] = None, + *, + api_version: str = ..., + cloud_setting: Optional[AzureClouds] = ..., + polling_interval: Optional[int] = ..., + **kwargs: Any + ) -> None: ... + + async def close(self) -> None: ... + + def send_request( + self, + request: HttpRequest, + *, + stream: bool = False, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: ... + + +namespace azure.mgmt.support.aio.operations + + class azure.mgmt.support.aio.operations.ChatTranscriptsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + support_ticket_name: str, + chat_transcript_name: str, + **kwargs: Any + ) -> ChatTranscriptDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ChatTranscriptDetails]: ... + + + class azure.mgmt.support.aio.operations.ChatTranscriptsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + support_ticket_name: str, + chat_transcript_name: str, + **kwargs: Any + ) -> ChatTranscriptDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ChatTranscriptDetails]: ... + + + class azure.mgmt.support.aio.operations.ClassifyProblemsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + + class azure.mgmt.support.aio.operations.ClassifyProblemsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + + class azure.mgmt.support.aio.operations.ClassifyServicesNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + async def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + async def classify_services( + self, + service_classification_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + + class azure.mgmt.support.aio.operations.ClassifyServicesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + async def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + async def classify_services( + self, + service_classification_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + + class azure.mgmt.support.aio.operations.CommunicationsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommunicationDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommunicationDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommunicationDetails]: ... + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace_async + async def get( + self, + support_ticket_name: str, + communication_name: str, + **kwargs: Any + ) -> CommunicationDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> AsyncItemPaged[CommunicationDetails]: ... + + + class azure.mgmt.support.aio.operations.CommunicationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommunicationDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommunicationDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[CommunicationDetails]: ... + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace_async + async def get( + self, + support_ticket_name: str, + communication_name: str, + **kwargs: Any + ) -> CommunicationDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> AsyncItemPaged[CommunicationDetails]: ... + + + class azure.mgmt.support.aio.operations.FileWorkspacesNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def create( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + @distributed_trace_async + async def get( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + + class azure.mgmt.support.aio.operations.FileWorkspacesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def create( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + @distributed_trace_async + async def get( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + + class azure.mgmt.support.aio.operations.FilesNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace_async + async def get( + self, + file_workspace_name: str, + file_name: str, + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace + def list( + self, + file_workspace_name: str, + **kwargs: Any + ) -> AsyncItemPaged[FileDetails]: ... + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.support.aio.operations.FilesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace_async + async def get( + self, + file_workspace_name: str, + file_name: str, + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace + def list( + self, + file_workspace_name: str, + **kwargs: Any + ) -> AsyncItemPaged[FileDetails]: ... + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.support.aio.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[Operation]: ... + + + class azure.mgmt.support.aio.operations.ProblemClassificationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + service_name: str, + problem_classification_name: str, + **kwargs: Any + ) -> ProblemClassification: ... + + @distributed_trace + def list( + self, + service_name: str, + **kwargs: Any + ) -> AsyncItemPaged[ProblemClassification]: ... + + + class azure.mgmt.support.aio.operations.ServicesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace_async + async def get( + self, + service_name: str, + **kwargs: Any + ) -> Service: ... + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged[Service]: ... + + + class azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SupportTicketDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SupportTicketDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SupportTicketDetails]: ... + + @overload + async def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace_async + async def get( + self, + support_ticket_name: str, + **kwargs: Any + ) -> SupportTicketDetails: ... + + @distributed_trace + def list( + self, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> AsyncItemPaged[SupportTicketDetails]: ... + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + + class azure.mgmt.support.aio.operations.SupportTicketsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SupportTicketDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SupportTicketDetails]: ... + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[SupportTicketDetails]: ... + + @overload + async def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + async def check_name_availability( + self, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace_async + async def get( + self, + support_ticket_name: str, + **kwargs: Any + ) -> SupportTicketDetails: ... + + @distributed_trace + def list( + self, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> AsyncItemPaged[SupportTicketDetails]: ... + + @overload + async def look_up_resource_id( + self, + look_up_resource_id_request: LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LookUpResourceIdResponse: ... + + @overload + async def look_up_resource_id( + self, + look_up_resource_id_request: LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LookUpResourceIdResponse: ... + + @overload + async def look_up_resource_id( + self, + look_up_resource_id_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LookUpResourceIdResponse: ... + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + +namespace azure.mgmt.support.models + + class azure.mgmt.support.models.ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INTERNAL = "Internal" + + + class azure.mgmt.support.models.ChatConversationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ACTIVE = "Active" + CLOSED = "Closed" + + + class azure.mgmt.support.models.ChatTranscriptDetails(ProxyResource): + id: str + name: str + properties: Optional[ChatTranscriptDetailsProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ChatTranscriptDetailsProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.support.models.ChatTranscriptDetailsProperties(_Model): + messages: Optional[list[MessageProperties]] + start_time: Optional[datetime] + + @overload + def __init__( + self, + *, + messages: Optional[list[MessageProperties]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.CheckNameAvailabilityInput(_Model): + name: str + type: Union[str, Type] + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, Type] + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.CheckNameAvailabilityOutput(_Model): + message: Optional[str] + name_available: Optional[bool] + reason: Optional[str] + + + class azure.mgmt.support.models.ClassificationService(_Model): + display_name: Optional[str] + resource_types: Optional[list[str]] + service_id: Optional[str] + + @overload + def __init__( + self, + *, + resource_types: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.CommunicationDetails(ProxyResource): + id: str + name: str + properties: CommunicationDetailsProperties + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: CommunicationDetailsProperties + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.support.models.CommunicationDetailsProperties(_Model): + body: str + communication_direction: Optional[Union[str, CommunicationDirection]] + communication_type: Optional[Union[str, CommunicationType]] + created_date: Optional[datetime] + sender: Optional[str] + subject: str + + @overload + def __init__( + self, + *, + body: str, + sender: Optional[str] = ..., + subject: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.CommunicationDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + INBOUND = "inbound" + OUTBOUND = "outbound" + + + class azure.mgmt.support.models.CommunicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + PHONE = "phone" + WEB = "web" + + + class azure.mgmt.support.models.Consent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NO = "No" + YES = "Yes" + + + class azure.mgmt.support.models.ContactProfile(_Model): + additional_email_addresses: Optional[list[str]] + country: str + first_name: str + last_name: str + phone_number: Optional[str] + preferred_contact_method: Union[str, PreferredContactMethod] + preferred_support_language: str + preferred_time_zone: str + primary_email_address: str + + @overload + def __init__( + self, + *, + additional_email_addresses: Optional[list[str]] = ..., + country: str, + first_name: str, + last_name: str, + phone_number: Optional[str] = ..., + preferred_contact_method: Union[str, PreferredContactMethod], + preferred_support_language: str, + preferred_time_zone: str, + primary_email_address: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + APPLICATION = "Application" + KEY = "Key" + MANAGED_IDENTITY = "ManagedIdentity" + USER = "User" + + + class azure.mgmt.support.models.DirectConnectEscalation(_Model): + allowed_severities: Optional[list[Union[str, SeverityLevel]]] + azure_ee_status: Optional[Union[str, EscalationStatus]] + reason_for_escalation: Optional[str] + + @overload + def __init__( + self, + *, + allowed_severities: Optional[list[Union[str, SeverityLevel]]] = ..., + azure_ee_status: Optional[Union[str, EscalationStatus]] = ..., + reason_for_escalation: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ErrorAdditionalInfo(_Model): + info: Optional[Any] + type: Optional[str] + + + class azure.mgmt.support.models.ErrorDetail(_Model): + additional_info: Optional[list[ErrorAdditionalInfo]] + code: Optional[str] + details: Optional[list[ErrorDetail]] + message: Optional[str] + target: Optional[str] + + + class azure.mgmt.support.models.ErrorResponse(_Model): + error: Optional[ErrorDetail] + + @overload + def __init__( + self, + *, + error: Optional[ErrorDetail] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.EscalationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + ESCALATION_AVAILABLE = "EscalationAvailable" + ESCALATION_INITIATED = "EscalationInitiated" + ESCALATION_PROCESSED = "EscalationProcessed" + ESCALATION_UNAVAILABLE = "EscalationUnavailable" + ESCALATION_UNSUPPORTED = "EscalationUnsupported" + + + class azure.mgmt.support.models.FileDetails(ProxyResource): + id: str + name: str + properties: Optional[FileDetailsProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[FileDetailsProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.support.models.FileDetailsProperties(_Model): + chunk_size: Optional[int] + created_on: Optional[datetime] + file_size: Optional[int] + number_of_chunks: Optional[int] + + @overload + def __init__( + self, + *, + chunk_size: Optional[int] = ..., + file_size: Optional[int] = ..., + number_of_chunks: Optional[int] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.FileWorkspaceDetails(ProxyResource): + id: str + name: str + properties: Optional[FileWorkspaceDetailsProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[FileWorkspaceDetailsProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.support.models.FileWorkspaceDetailsProperties(_Model): + created_on: Optional[datetime] + expiration_time: Optional[datetime] + + + class azure.mgmt.support.models.IsTemporaryTicket(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NO = "No" + YES = "Yes" + + + class azure.mgmt.support.models.LookUpResourceIdRequest(_Model): + identifier: Optional[str] + type: Optional[Literal["Support/supportTickets"]] + + @overload + def __init__( + self, + *, + identifier: Optional[str] = ..., + type: Optional[Literal[Support/supportTickets]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.LookUpResourceIdResponse(_Model): + resource_id: Optional[str] + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.MessageProperties(_Model): + body: Optional[str] + communication_direction: Optional[Union[str, CommunicationDirection]] + content_type: Optional[str] + created_date: Optional[datetime] + sender: Optional[str] + + @overload + def __init__( + self, + *, + body: Optional[str] = ..., + sender: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.Operation(_Model): + action_type: Optional[Union[str, ActionType]] + display: Optional[OperationDisplay] + is_data_action: Optional[bool] + name: Optional[str] + origin: Optional[Union[str, Origin]] + + @overload + def __init__( + self, + *, + display: Optional[OperationDisplay] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.OperationDisplay(_Model): + description: Optional[str] + operation: Optional[str] + provider: Optional[str] + resource: Optional[str] + + + class azure.mgmt.support.models.Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + SYSTEM = "system" + USER = "user" + USER_SYSTEM = "user,system" + + + class azure.mgmt.support.models.PreferredContactMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + EMAIL = "email" + PHONE = "phone" + + + class azure.mgmt.support.models.ProblemClassification(ProxyResource): + id: str + name: str + properties: Optional[ProblemClassificationProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ProblemClassificationProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.support.models.ProblemClassificationProperties(_Model): + display_name: Optional[str] + secondary_consent_enabled: Optional[list[SecondaryConsentEnabled]] + + @overload + def __init__( + self, + *, + display_name: Optional[str] = ..., + secondary_consent_enabled: Optional[list[SecondaryConsentEnabled]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ProblemClassificationsClassificationInput(_Model): + issue_summary: str + resource_id: Optional[str] + + @overload + def __init__( + self, + *, + issue_summary: str, + resource_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ProblemClassificationsClassificationOutput(_Model): + problem_classification_results: Optional[list[ProblemClassificationsClassificationResult]] + + @overload + def __init__( + self, + *, + problem_classification_results: Optional[list[ProblemClassificationsClassificationResult]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ProblemClassificationsClassificationResult(_Model): + article_id: Optional[str] + description: Optional[str] + problem_classification_id: Optional[str] + problem_id: Optional[str] + related_service: Optional[ClassificationService] + service_id: Optional[str] + title: Optional[str] + + @overload + def __init__( + self, + *, + related_service: Optional[ClassificationService] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ProxyResource(Resource): + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.support.models.QuotaChangeRequest(_Model): + payload: Optional[str] + region: Optional[str] + + @overload + def __init__( + self, + *, + payload: Optional[str] = ..., + region: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.QuotaTicketDetails(_Model): + quota_change_request_sub_type: Optional[str] + quota_change_request_version: Optional[str] + quota_change_requests: Optional[list[QuotaChangeRequest]] + + @overload + def __init__( + self, + *, + quota_change_request_sub_type: Optional[str] = ..., + quota_change_request_version: Optional[str] = ..., + quota_change_requests: Optional[list[QuotaChangeRequest]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.Resource(_Model): + id: Optional[str] + name: Optional[str] + system_data: Optional[SystemData] + type: Optional[str] + + + class azure.mgmt.support.models.SecondaryConsent(_Model): + type: Optional[str] + user_consent: Optional[Union[str, UserConsent]] + + @overload + def __init__( + self, + *, + type: Optional[str] = ..., + user_consent: Optional[Union[str, UserConsent]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.SecondaryConsentEnabled(_Model): + description: Optional[str] + type: Optional[str] + + @overload + def __init__( + self, + *, + description: Optional[str] = ..., + type: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.Service(ProxyResource): + id: str + name: str + properties: Optional[ServiceProperties] + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: Optional[ServiceProperties] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.support.models.ServiceClassificationAnswer(ClassificationService): + child_service: Optional[ClassificationService] + display_name: str + resource_types: list[str] + service_id: str + + @overload + def __init__( + self, + *, + child_service: Optional[ClassificationService] = ..., + resource_types: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ServiceClassificationOutput(_Model): + service_classification_results: Optional[list[ServiceClassificationAnswer]] + + @overload + def __init__( + self, + *, + service_classification_results: Optional[list[ServiceClassificationAnswer]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ServiceClassificationRequest(_Model): + additional_context: Optional[str] + issue_summary: Optional[str] + resource_id: Optional[str] + + @overload + def __init__( + self, + *, + additional_context: Optional[str] = ..., + issue_summary: Optional[str] = ..., + resource_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.ServiceLevelAgreement(_Model): + expiration_time: Optional[datetime] + sla_minutes: Optional[int] + start_time: Optional[datetime] + + + class azure.mgmt.support.models.ServiceProperties(_Model): + display_name: Optional[str] + resource_types: Optional[list[str]] + + @overload + def __init__( + self, + *, + display_name: Optional[str] = ..., + resource_types: Optional[list[str]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.SeverityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CRITICAL = "critical" + HIGHESTCRITICALIMPACT = "highestcriticalimpact" + MINIMAL = "minimal" + MODERATE = "moderate" + + + class azure.mgmt.support.models.Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CLOSED = "closed" + OPEN = "open" + + + class azure.mgmt.support.models.SupportChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + CHAT = "Chat" + WEB = "Web" + + + class azure.mgmt.support.models.SupportEngineer(_Model): + email_address: Optional[str] + + + class azure.mgmt.support.models.SupportTicketDetails(ProxyResource): + id: str + name: str + properties: SupportTicketDetailsProperties + system_data: SystemData + type: str + + def __getattr__(self, name: str) -> Any: ... + + @overload + def __init__( + self, + *, + properties: SupportTicketDetailsProperties + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + def __setattr__( + self, + key: str, + value: Any + ) -> None: ... + + + class azure.mgmt.support.models.SupportTicketDetailsProperties(_Model): + advanced_diagnostic_consent: Union[str, Consent] + chat_conversation_status: Optional[Union[str, ChatConversationStatus]] + community_forum_post: Optional[str] + contact_details: ContactProfile + created_date: Optional[datetime] + description: str + direct_connect_escalation: Optional[DirectConnectEscalation] + enrollment_id: Optional[str] + file_workspace_name: Optional[str] + is_temporary_ticket: Optional[Union[str, IsTemporaryTicket]] + modified_date: Optional[datetime] + problem_classification_display_name: Optional[str] + problem_classification_id: str + problem_scoping_questions: Optional[str] + problem_start_time: Optional[datetime] + quota_ticket_details: Optional[QuotaTicketDetails] + require24_x7_response: Optional[bool] + secondary_consent: Optional[list[SecondaryConsent]] + service_display_name: Optional[str] + service_id: str + service_level_agreement: Optional[ServiceLevelAgreement] + severity: Union[str, SeverityLevel] + status: Optional[str] + support_channel: Optional[Union[str, SupportChannel]] + support_engineer: Optional[SupportEngineer] + support_plan_display_name: Optional[str] + support_plan_id: Optional[str] + support_plan_type: Optional[str] + support_ticket_id: Optional[str] + technical_ticket_details: Optional[TechnicalTicketDetails] + title: str + + @overload + def __init__( + self, + *, + advanced_diagnostic_consent: Union[str, Consent], + community_forum_post: Optional[str] = ..., + contact_details: ContactProfile, + description: str, + direct_connect_escalation: Optional[DirectConnectEscalation] = ..., + enrollment_id: Optional[str] = ..., + file_workspace_name: Optional[str] = ..., + problem_classification_id: str, + problem_scoping_questions: Optional[str] = ..., + problem_start_time: Optional[datetime] = ..., + quota_ticket_details: Optional[QuotaTicketDetails] = ..., + require24_x7_response: Optional[bool] = ..., + secondary_consent: Optional[list[SecondaryConsent]] = ..., + service_id: str, + service_level_agreement: Optional[ServiceLevelAgreement] = ..., + severity: Union[str, SeverityLevel], + support_engineer: Optional[SupportEngineer] = ..., + support_plan_id: Optional[str] = ..., + support_ticket_id: Optional[str] = ..., + technical_ticket_details: Optional[TechnicalTicketDetails] = ..., + title: str + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.SystemData(_Model): + created_at: Optional[datetime] + created_by: Optional[str] + created_by_type: Optional[Union[str, CreatedByType]] + last_modified_at: Optional[datetime] + last_modified_by: Optional[str] + last_modified_by_type: Optional[Union[str, CreatedByType]] + + @overload + def __init__( + self, + *, + created_at: Optional[datetime] = ..., + created_by: Optional[str] = ..., + created_by_type: Optional[Union[str, CreatedByType]] = ..., + last_modified_at: Optional[datetime] = ..., + last_modified_by: Optional[str] = ..., + last_modified_by_type: Optional[Union[str, CreatedByType]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.TechnicalTicketDetails(_Model): + resource_id: Optional[str] + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + MICROSOFT_SUPPORT_COMMUNICATIONS = "Microsoft.Support/communications" + MICROSOFT_SUPPORT_SUPPORT_TICKETS = "Microsoft.Support/supportTickets" + + + class azure.mgmt.support.models.UpdateContactProfile(_Model): + additional_email_addresses: Optional[list[str]] + country: Optional[str] + first_name: Optional[str] + last_name: Optional[str] + phone_number: Optional[str] + preferred_contact_method: Optional[Union[str, PreferredContactMethod]] + preferred_support_language: Optional[str] + preferred_time_zone: Optional[str] + primary_email_address: Optional[str] + + @overload + def __init__( + self, + *, + additional_email_addresses: Optional[list[str]] = ..., + country: Optional[str] = ..., + first_name: Optional[str] = ..., + last_name: Optional[str] = ..., + phone_number: Optional[str] = ..., + preferred_contact_method: Optional[Union[str, PreferredContactMethod]] = ..., + preferred_support_language: Optional[str] = ..., + preferred_time_zone: Optional[str] = ..., + primary_email_address: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.UpdateSupportTicket(_Model): + advanced_diagnostic_consent: Optional[Union[str, Consent]] + contact_details: Optional[UpdateContactProfile] + direct_connect_escalation: Optional[DirectConnectEscalation] + secondary_consent: Optional[list[SecondaryConsent]] + severity: Optional[Union[str, SeverityLevel]] + status: Optional[Union[str, Status]] + + @overload + def __init__( + self, + *, + advanced_diagnostic_consent: Optional[Union[str, Consent]] = ..., + contact_details: Optional[UpdateContactProfile] = ..., + direct_connect_escalation: Optional[DirectConnectEscalation] = ..., + secondary_consent: Optional[list[SecondaryConsent]] = ..., + severity: Optional[Union[str, SeverityLevel]] = ..., + status: Optional[Union[str, Status]] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.UploadFile(_Model): + chunk_index: Optional[int] + content: Optional[str] + + @overload + def __init__( + self, + *, + chunk_index: Optional[int] = ..., + content: Optional[str] = ... + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: ... + + + class azure.mgmt.support.models.UserConsent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + NO = "No" + YES = "Yes" + + +namespace azure.mgmt.support.operations + + class azure.mgmt.support.operations.ChatTranscriptsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + support_ticket_name: str, + chat_transcript_name: str, + **kwargs: Any + ) -> ChatTranscriptDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + **kwargs: Any + ) -> ItemPaged[ChatTranscriptDetails]: ... + + + class azure.mgmt.support.operations.ChatTranscriptsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + support_ticket_name: str, + chat_transcript_name: str, + **kwargs: Any + ) -> ChatTranscriptDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + **kwargs: Any + ) -> ItemPaged[ChatTranscriptDetails]: ... + + + class azure.mgmt.support.operations.ClassifyProblemsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + + class azure.mgmt.support.operations.ClassifyProblemsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ProblemClassificationsClassificationOutput: ... + + + class azure.mgmt.support.operations.ClassifyServicesNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + def classify_services( + self, + service_classification_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + + class azure.mgmt.support.operations.ClassifyServicesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + def classify_services( + self, + service_classification_request: ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + @overload + def classify_services( + self, + service_classification_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> ServiceClassificationOutput: ... + + + class azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommunicationDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommunicationDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommunicationDetails]: ... + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace + def get( + self, + support_ticket_name: str, + communication_name: str, + **kwargs: Any + ) -> CommunicationDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> ItemPaged[CommunicationDetails]: ... + + + class azure.mgmt.support.operations.CommunicationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommunicationDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommunicationDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[CommunicationDetails]: ... + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace + def get( + self, + support_ticket_name: str, + communication_name: str, + **kwargs: Any + ) -> CommunicationDetails: ... + + @distributed_trace + def list( + self, + support_ticket_name: str, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> ItemPaged[CommunicationDetails]: ... + + + class azure.mgmt.support.operations.FileWorkspacesNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def create( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + @distributed_trace + def get( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + + class azure.mgmt.support.operations.FileWorkspacesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def create( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + @distributed_trace + def get( + self, + file_workspace_name: str, + **kwargs: Any + ) -> FileWorkspaceDetails: ... + + + class azure.mgmt.support.operations.FilesNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace + def get( + self, + file_workspace_name: str, + file_name: str, + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace + def list( + self, + file_workspace_name: str, + **kwargs: Any + ) -> ItemPaged[FileDetails]: ... + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.support.operations.FilesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace + def get( + self, + file_workspace_name: str, + file_name: str, + **kwargs: Any + ) -> FileDetails: ... + + @distributed_trace + def list( + self, + file_workspace_name: str, + **kwargs: Any + ) -> ItemPaged[FileDetails]: ... + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: ... + + + class azure.mgmt.support.operations.Operations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[Operation]: ... + + + class azure.mgmt.support.operations.ProblemClassificationsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + service_name: str, + problem_classification_name: str, + **kwargs: Any + ) -> ProblemClassification: ... + + @distributed_trace + def list( + self, + service_name: str, + **kwargs: Any + ) -> ItemPaged[ProblemClassification]: ... + + + class azure.mgmt.support.operations.ServicesOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @distributed_trace + def get( + self, + service_name: str, + **kwargs: Any + ) -> Service: ... + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged[Service]: ... + + + class azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SupportTicketDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SupportTicketDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SupportTicketDetails]: ... + + @overload + def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace + def get( + self, + support_ticket_name: str, + **kwargs: Any + ) -> SupportTicketDetails: ... + + @distributed_trace + def list( + self, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> ItemPaged[SupportTicketDetails]: ... + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + + class azure.mgmt.support.operations.SupportTicketsOperations: + + def __init__( + self, + *args, + **kwargs + ) -> None: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SupportTicketDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SupportTicketDetails]: ... + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[SupportTicketDetails]: ... + + @overload + def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + check_name_availability_input: CheckNameAvailabilityInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @overload + def check_name_availability( + self, + check_name_availability_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> CheckNameAvailabilityOutput: ... + + @distributed_trace + def get( + self, + support_ticket_name: str, + **kwargs: Any + ) -> SupportTicketDetails: ... + + @distributed_trace + def list( + self, + *, + filter: Optional[str] = ..., + top: Optional[int] = ..., + **kwargs: Any + ) -> ItemPaged[SupportTicketDetails]: ... + + @overload + def look_up_resource_id( + self, + look_up_resource_id_request: LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LookUpResourceIdResponse: ... + + @overload + def look_up_resource_id( + self, + look_up_resource_id_request: LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LookUpResourceIdResponse: ... + + @overload + def look_up_resource_id( + self, + look_up_resource_id_request: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LookUpResourceIdResponse: ... + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> SupportTicketDetails: ... + + +namespace azure.mgmt.support.types + + class azure.mgmt.support.types.ChatTranscriptDetails(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ChatTranscriptDetailsProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ChatTranscriptDetailsProperties + system_data: SystemData + type: str + + + class azure.mgmt.support.types.ChatTranscriptDetailsProperties(TypedDict, total=False): + key "startTime": str + messages: list[MessageProperties] + start_time: str + + + class azure.mgmt.support.types.CheckNameAvailabilityInput(TypedDict, total=False): + key "name": Required[str] + key "type": Required[Union[str, Type]] + name: str + type: Union[str, Type] + + + class azure.mgmt.support.types.CheckNameAvailabilityOutput(TypedDict, total=False): + key "message": str + key "nameAvailable": bool + key "reason": str + message: str + name_available: bool + reason: str + + + class azure.mgmt.support.types.ClassificationService(TypedDict, total=False): + key "displayName": str + key "serviceId": str + display_name: str + resourceTypes: list[str] + resource_types: list[str] + service_id: str + + + class azure.mgmt.support.types.CommunicationDetails(ProxyResource): + key "id": str + key "name": str + key "properties": Required[CommunicationDetailsProperties] + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: CommunicationDetailsProperties + system_data: SystemData + type: str + + + class azure.mgmt.support.types.CommunicationDetailsProperties(TypedDict, total=False): + key "body": Required[str] + key "communicationDirection": Union[str, CommunicationDirection] + key "communicationType": Union[str, CommunicationType] + key "createdDate": str + key "sender": str + key "subject": Required[str] + body: str + communication_direction: Union[str, CommunicationDirection] + communication_type: Union[str, CommunicationType] + created_date: str + sender: str + subject: str + + + class azure.mgmt.support.types.ContactProfile(TypedDict, total=False): + key "country": Required[str] + key "firstName": Required[str] + key "lastName": Required[str] + key "phoneNumber": str + key "preferredContactMethod": Required[Union[str, PreferredContactMethod]] + key "preferredSupportLanguage": Required[str] + key "preferredTimeZone": Required[str] + key "primaryEmailAddress": Required[str] + additionalEmailAddresses: list[str] + additional_email_addresses: list[str] + country: str + first_name: str + last_name: str + phone_number: str + preferred_contact_method: Union[str, PreferredContactMethod] + preferred_support_language: str + preferred_time_zone: str + primary_email_address: str + + + class azure.mgmt.support.types.DirectConnectEscalation(TypedDict, total=False): + key "azureEEStatus": Union[str, EscalationStatus] + key "reasonForEscalation": str + allowedSeverities: list[Union[str, SeverityLevel]] + allowed_severities: list[Union[str, SeverityLevel]] + azure_ee_status: Union[str, EscalationStatus] + reason_for_escalation: str + + + class azure.mgmt.support.types.ErrorAdditionalInfo(TypedDict, total=False): + key "info": Any + key "type": str + info: Any + type: str + + + class azure.mgmt.support.types.ErrorDetail(TypedDict, total=False): + key "code": str + key "message": str + key "target": str + additionalInfo: list[ErrorAdditionalInfo] + additional_info: list[ErrorAdditionalInfo] + code: str + details: list[ErrorDetail] + message: str + target: str + + + class azure.mgmt.support.types.ErrorResponse(TypedDict, total=False): + key "error": ForwardRef('ErrorDetail', module='types') + error: ErrorDetail + + + class azure.mgmt.support.types.FileDetails(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('FileDetailsProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: FileDetailsProperties + system_data: SystemData + type: str + + + class azure.mgmt.support.types.FileDetailsProperties(TypedDict, total=False): + key "chunkSize": int + key "createdOn": str + key "fileSize": int + key "numberOfChunks": int + chunk_size: int + created_on: str + file_size: int + number_of_chunks: int + + + class azure.mgmt.support.types.FileWorkspaceDetails(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('FileWorkspaceDetailsProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: FileWorkspaceDetailsProperties + system_data: SystemData + type: str + + + class azure.mgmt.support.types.FileWorkspaceDetailsProperties(TypedDict, total=False): + key "createdOn": str + key "expirationTime": str + created_on: str + expiration_time: str + + + class azure.mgmt.support.types.LookUpResourceIdRequest(TypedDict, total=False): + key "identifier": str + key "type": Literal["Support/supportTickets"] + identifier: str + type: Literal[Support/supportTickets] + + + class azure.mgmt.support.types.LookUpResourceIdResponse(TypedDict, total=False): + key "resourceId": str + resource_id: str + + + class azure.mgmt.support.types.MessageProperties(TypedDict, total=False): + key "body": str + key "communicationDirection": Union[str, CommunicationDirection] + key "contentType": str + key "createdDate": str + key "sender": str + body: str + communication_direction: Union[str, CommunicationDirection] + content_type: str + created_date: str + sender: str + + + class azure.mgmt.support.types.Operation(TypedDict, total=False): + key "actionType": Union[str, ActionType] + key "display": ForwardRef('OperationDisplay', module='types') + key "isDataAction": bool + key "name": str + key "origin": Union[str, Origin] + action_type: Union[str, ActionType] + display: OperationDisplay + is_data_action: bool + name: str + origin: Union[str, Origin] + + + class azure.mgmt.support.types.OperationDisplay(TypedDict, total=False): + key "description": str + key "operation": str + key "provider": str + key "resource": str + description: str + operation: str + provider: str + resource: str + + + class azure.mgmt.support.types.ProblemClassification(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ProblemClassificationProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ProblemClassificationProperties + system_data: SystemData + type: str + + + class azure.mgmt.support.types.ProblemClassificationProperties(TypedDict, total=False): + key "displayName": str + display_name: str + secondaryConsentEnabled: list[SecondaryConsentEnabled] + secondary_consent_enabled: list[SecondaryConsentEnabled] + + + class azure.mgmt.support.types.ProblemClassificationsClassificationInput(TypedDict, total=False): + key "issueSummary": Required[str] + key "resourceId": str + issue_summary: str + resource_id: str + + + class azure.mgmt.support.types.ProblemClassificationsClassificationOutput(TypedDict, total=False): + problemClassificationResults: list[ProblemClassificationsClassificationResult] + problem_classification_results: list[ProblemClassificationsClassificationResult] + + + class azure.mgmt.support.types.ProblemClassificationsClassificationResult(TypedDict, total=False): + key "articleId": str + key "description": str + key "problemClassificationId": str + key "problemId": str + key "relatedService": ForwardRef('ClassificationService', module='types') + key "serviceId": str + key "title": str + article_id: str + description: str + problem_classification_id: str + problem_id: str + related_service: ClassificationService + service_id: str + title: str + + + class azure.mgmt.support.types.ProxyResource(Resource): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.support.types.QuotaChangeRequest(TypedDict, total=False): + key "payload": str + key "region": str + payload: str + region: str + + + class azure.mgmt.support.types.QuotaTicketDetails(TypedDict, total=False): + key "quotaChangeRequestSubType": str + key "quotaChangeRequestVersion": str + quotaChangeRequests: list[QuotaChangeRequest] + quota_change_request_sub_type: str + quota_change_request_version: str + quota_change_requests: list[QuotaChangeRequest] + + + class azure.mgmt.support.types.Resource(TypedDict, total=False): + key "id": str + key "name": str + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + system_data: SystemData + type: str + + + class azure.mgmt.support.types.SecondaryConsent(TypedDict, total=False): + key "type": str + key "userConsent": Union[str, UserConsent] + type: str + user_consent: Union[str, UserConsent] + + + class azure.mgmt.support.types.SecondaryConsentEnabled(TypedDict, total=False): + key "description": str + key "type": str + description: str + type: str + + + class azure.mgmt.support.types.Service(ProxyResource): + key "id": str + key "name": str + key "properties": ForwardRef('ServiceProperties', module='types') + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: ServiceProperties + system_data: SystemData + type: str + + + class azure.mgmt.support.types.ServiceClassificationAnswer(ClassificationService): + key "childService": ForwardRef('ClassificationService', module='types') + key "displayName": str + key "serviceId": str + child_service: ClassificationService + display_name: str + resourceTypes: list[str] + resource_types: list[str] + service_id: str + + + class azure.mgmt.support.types.ServiceClassificationOutput(TypedDict, total=False): + serviceClassificationResults: list[ServiceClassificationAnswer] + service_classification_results: list[ServiceClassificationAnswer] + + + class azure.mgmt.support.types.ServiceClassificationRequest(TypedDict, total=False): + key "additionalContext": str + key "issueSummary": str + key "resourceId": str + additional_context: str + issue_summary: str + resource_id: str + + + class azure.mgmt.support.types.ServiceLevelAgreement(TypedDict, total=False): + key "expirationTime": str + key "slaMinutes": int + key "startTime": str + expiration_time: str + sla_minutes: int + start_time: str + + + class azure.mgmt.support.types.ServiceProperties(TypedDict, total=False): + key "displayName": str + display_name: str + resourceTypes: list[str] + resource_types: list[str] + + + class azure.mgmt.support.types.SupportEngineer(TypedDict, total=False): + key "emailAddress": str + email_address: str + + + class azure.mgmt.support.types.SupportTicketDetails(ProxyResource): + key "id": str + key "name": str + key "properties": Required[SupportTicketDetailsProperties] + key "systemData": ForwardRef('SystemData', module='types') + key "type": str + id: str + name: str + properties: SupportTicketDetailsProperties + system_data: SystemData + type: str + + + class azure.mgmt.support.types.SupportTicketDetailsProperties(TypedDict, total=False): + key "advancedDiagnosticConsent": Required[Union[str, Consent]] + key "chatConversationStatus": Union[str, ChatConversationStatus] + key "communityForumPost": str + key "contactDetails": Required[ContactProfile] + key "createdDate": str + key "description": Required[str] + key "directConnectEscalation": ForwardRef('DirectConnectEscalation', module='types') + key "enrollmentId": str + key "fileWorkspaceName": str + key "isTemporaryTicket": Union[str, IsTemporaryTicket] + key "modifiedDate": str + key "problemClassificationDisplayName": str + key "problemClassificationId": Required[str] + key "problemScopingQuestions": str + key "problemStartTime": str + key "quotaTicketDetails": ForwardRef('QuotaTicketDetails', module='types') + key "require24X7Response": bool + key "serviceDisplayName": str + key "serviceId": Required[str] + key "serviceLevelAgreement": ForwardRef('ServiceLevelAgreement', module='types') + key "severity": Required[Union[str, SeverityLevel]] + key "status": str + key "supportChannel": Union[str, SupportChannel] + key "supportEngineer": ForwardRef('SupportEngineer', module='types') + key "supportPlanDisplayName": str + key "supportPlanId": str + key "supportPlanType": str + key "supportTicketId": str + key "technicalTicketDetails": ForwardRef('TechnicalTicketDetails', module='types') + key "title": Required[str] + advanced_diagnostic_consent: Union[str, Consent] + chat_conversation_status: Union[str, ChatConversationStatus] + community_forum_post: str + contact_details: ContactProfile + created_date: str + description: str + direct_connect_escalation: DirectConnectEscalation + enrollment_id: str + file_workspace_name: str + is_temporary_ticket: Union[str, IsTemporaryTicket] + modified_date: str + problem_classification_display_name: str + problem_classification_id: str + problem_scoping_questions: str + problem_start_time: str + quota_ticket_details: QuotaTicketDetails + require24_x7_response: bool + secondaryConsent: list[SecondaryConsent] + secondary_consent: list[SecondaryConsent] + service_display_name: str + service_id: str + service_level_agreement: ServiceLevelAgreement + severity: Union[str, SeverityLevel] + status: str + support_channel: Union[str, SupportChannel] + support_engineer: SupportEngineer + support_plan_display_name: str + support_plan_id: str + support_plan_type: str + support_ticket_id: str + technical_ticket_details: TechnicalTicketDetails + title: str + + + class azure.mgmt.support.types.SystemData(TypedDict, total=False): + key "createdAt": str + key "createdBy": str + key "createdByType": Union[str, CreatedByType] + key "lastModifiedAt": str + key "lastModifiedBy": str + key "lastModifiedByType": Union[str, CreatedByType] + created_at: str + created_by: str + created_by_type: Union[str, CreatedByType] + last_modified_at: str + last_modified_by: str + last_modified_by_type: Union[str, CreatedByType] + + + class azure.mgmt.support.types.TechnicalTicketDetails(TypedDict, total=False): + key "resourceId": str + resource_id: str + + + class azure.mgmt.support.types.UpdateContactProfile(TypedDict, total=False): + key "country": str + key "firstName": str + key "lastName": str + key "phoneNumber": str + key "preferredContactMethod": Union[str, PreferredContactMethod] + key "preferredSupportLanguage": str + key "preferredTimeZone": str + key "primaryEmailAddress": str + additionalEmailAddresses: list[str] + additional_email_addresses: list[str] + country: str + first_name: str + last_name: str + phone_number: str + preferred_contact_method: Union[str, PreferredContactMethod] + preferred_support_language: str + preferred_time_zone: str + primary_email_address: str + + + class azure.mgmt.support.types.UpdateSupportTicket(TypedDict, total=False): + key "advancedDiagnosticConsent": Union[str, Consent] + key "contactDetails": ForwardRef('UpdateContactProfile', module='types') + key "directConnectEscalation": ForwardRef('DirectConnectEscalation', module='types') + key "severity": Union[str, SeverityLevel] + key "status": Union[str, Status] + advanced_diagnostic_consent: Union[str, Consent] + contact_details: UpdateContactProfile + direct_connect_escalation: DirectConnectEscalation + secondaryConsent: list[SecondaryConsent] + secondary_consent: list[SecondaryConsent] + severity: Union[str, SeverityLevel] + status: Union[str, Status] + + + class azure.mgmt.support.types.UploadFile(TypedDict, total=False): + key "chunkIndex": int + key "content": str + chunk_index: int + content: str + + +``` \ No newline at end of file diff --git a/sdk/support/azure-mgmt-support/api.metadata.yml b/sdk/support/azure-mgmt-support/api.metadata.yml new file mode 100644 index 000000000000..f9b29a727f7b --- /dev/null +++ b/sdk/support/azure-mgmt-support/api.metadata.yml @@ -0,0 +1,3 @@ +apiMdSha256: e3505c58b1214ce03f45c0b6a7daa0301a761537128b49af3dd30ddb70dbf847 +parserVersion: 0.3.28 +pythonVersion: 3.13.14 diff --git a/sdk/support/azure-mgmt-support/apiview-properties.json b/sdk/support/azure-mgmt-support/apiview-properties.json new file mode 100644 index 000000000000..e5e0c0e1e223 --- /dev/null +++ b/sdk/support/azure-mgmt-support/apiview-properties.json @@ -0,0 +1,155 @@ +{ + "CrossLanguagePackageId": "Microsoft.Support", + "CrossLanguageDefinitionId": { + "azure.mgmt.support.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.support.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.support.models.ChatTranscriptDetails": "Microsoft.Support.ChatTranscriptDetails", + "azure.mgmt.support.models.ChatTranscriptDetailsProperties": "Microsoft.Support.ChatTranscriptDetailsProperties", + "azure.mgmt.support.models.CheckNameAvailabilityInput": "Microsoft.Support.CheckNameAvailabilityInput", + "azure.mgmt.support.models.CheckNameAvailabilityOutput": "Microsoft.Support.CheckNameAvailabilityOutput", + "azure.mgmt.support.models.ClassificationService": "Microsoft.Support.ClassificationService", + "azure.mgmt.support.models.CommunicationDetails": "Microsoft.Support.CommunicationDetails", + "azure.mgmt.support.models.CommunicationDetailsProperties": "Microsoft.Support.CommunicationDetailsProperties", + "azure.mgmt.support.models.ContactProfile": "Microsoft.Support.ContactProfile", + "azure.mgmt.support.models.DirectConnectEscalation": "Microsoft.Support.DirectConnectEscalation", + "azure.mgmt.support.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.support.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.support.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.support.models.FileDetails": "Microsoft.Support.FileDetails", + "azure.mgmt.support.models.FileDetailsProperties": "Microsoft.Support.FileDetailsProperties", + "azure.mgmt.support.models.FileWorkspaceDetails": "Microsoft.Support.FileWorkspaceDetails", + "azure.mgmt.support.models.FileWorkspaceDetailsProperties": "Microsoft.Support.FileWorkspaceDetailsProperties", + "azure.mgmt.support.models.LookUpResourceIdRequest": "Microsoft.Support.LookUpResourceIdRequest", + "azure.mgmt.support.models.LookUpResourceIdResponse": "Microsoft.Support.LookUpResourceIdResponse", + "azure.mgmt.support.models.MessageProperties": "Microsoft.Support.MessageProperties", + "azure.mgmt.support.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.support.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.support.models.ProblemClassification": "Microsoft.Support.ProblemClassification", + "azure.mgmt.support.models.ProblemClassificationProperties": "Microsoft.Support.ProblemClassificationProperties", + "azure.mgmt.support.models.ProblemClassificationsClassificationInput": "Microsoft.Support.ProblemClassificationsClassificationInput", + "azure.mgmt.support.models.ProblemClassificationsClassificationOutput": "Microsoft.Support.ProblemClassificationsClassificationOutput", + "azure.mgmt.support.models.ProblemClassificationsClassificationResult": "Microsoft.Support.ProblemClassificationsClassificationResult", + "azure.mgmt.support.models.QuotaChangeRequest": "Microsoft.Support.QuotaChangeRequest", + "azure.mgmt.support.models.QuotaTicketDetails": "Microsoft.Support.QuotaTicketDetails", + "azure.mgmt.support.models.SecondaryConsent": "Microsoft.Support.SecondaryConsent", + "azure.mgmt.support.models.SecondaryConsentEnabled": "Microsoft.Support.SecondaryConsentEnabled", + "azure.mgmt.support.models.Service": "Microsoft.Support.Service", + "azure.mgmt.support.models.ServiceClassificationAnswer": "Microsoft.Support.ServiceClassificationAnswer", + "azure.mgmt.support.models.ServiceClassificationOutput": "Microsoft.Support.ServiceClassificationOutput", + "azure.mgmt.support.models.ServiceClassificationRequest": "Microsoft.Support.ServiceClassificationRequest", + "azure.mgmt.support.models.ServiceLevelAgreement": "Microsoft.Support.ServiceLevelAgreement", + "azure.mgmt.support.models.ServiceProperties": "Microsoft.Support.ServiceProperties", + "azure.mgmt.support.models.SupportEngineer": "Microsoft.Support.SupportEngineer", + "azure.mgmt.support.models.SupportTicketDetails": "Microsoft.Support.SupportTicketDetails", + "azure.mgmt.support.models.SupportTicketDetailsProperties": "Microsoft.Support.SupportTicketDetailsProperties", + "azure.mgmt.support.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.support.models.TechnicalTicketDetails": "Microsoft.Support.TechnicalTicketDetails", + "azure.mgmt.support.models.UpdateContactProfile": "Microsoft.Support.UpdateContactProfile", + "azure.mgmt.support.models.UpdateSupportTicket": "Microsoft.Support.UpdateSupportTicket", + "azure.mgmt.support.models.UploadFile": "Microsoft.Support.UploadFile", + "azure.mgmt.support.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.support.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.support.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.support.models.CommunicationType": "Microsoft.Support.CommunicationType", + "azure.mgmt.support.models.CommunicationDirection": "Microsoft.Support.CommunicationDirection", + "azure.mgmt.support.models.Type": "Microsoft.Support.Type", + "azure.mgmt.support.models.SeverityLevel": "Microsoft.Support.SeverityLevel", + "azure.mgmt.support.models.Consent": "Microsoft.Support.Consent", + "azure.mgmt.support.models.PreferredContactMethod": "Microsoft.Support.PreferredContactMethod", + "azure.mgmt.support.models.IsTemporaryTicket": "Microsoft.Support.IsTemporaryTicket", + "azure.mgmt.support.models.UserConsent": "Microsoft.Support.UserConsent", + "azure.mgmt.support.models.EscalationStatus": "Microsoft.Support.EscalationStatus", + "azure.mgmt.support.models.SupportChannel": "Microsoft.Support.SupportChannel", + "azure.mgmt.support.models.ChatConversationStatus": "Microsoft.Support.ChatConversationStatus", + "azure.mgmt.support.models.Status": "Microsoft.Support.Status", + "azure.mgmt.support.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.support.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.support.operations.ServicesOperations.get": "Microsoft.Support.Services.get", + "azure.mgmt.support.aio.operations.ServicesOperations.get": "Microsoft.Support.Services.get", + "azure.mgmt.support.operations.ServicesOperations.list": "Microsoft.Support.Services.list", + "azure.mgmt.support.aio.operations.ServicesOperations.list": "Microsoft.Support.Services.list", + "azure.mgmt.support.operations.ClassifyServicesOperations.classify_services": "Microsoft.Support.ClassifyServices.classifyServices", + "azure.mgmt.support.aio.operations.ClassifyServicesOperations.classify_services": "Microsoft.Support.ClassifyServices.classifyServices", + "azure.mgmt.support.operations.ClassifyServicesNoSubscriptionOperations.classify_services": "Microsoft.Support.ClassifyServicesNoSubscription.classifyServices", + "azure.mgmt.support.aio.operations.ClassifyServicesNoSubscriptionOperations.classify_services": "Microsoft.Support.ClassifyServicesNoSubscription.classifyServices", + "azure.mgmt.support.operations.ClassifyProblemsOperations.classify_problems": "Microsoft.Support.ClassifyProblems.classifyProblems", + "azure.mgmt.support.aio.operations.ClassifyProblemsOperations.classify_problems": "Microsoft.Support.ClassifyProblems.classifyProblems", + "azure.mgmt.support.operations.ClassifyProblemsNoSubscriptionOperations.classify_problems": "Microsoft.Support.ClassifyProblemsNoSubscription.classifyProblems", + "azure.mgmt.support.aio.operations.ClassifyProblemsNoSubscriptionOperations.classify_problems": "Microsoft.Support.ClassifyProblemsNoSubscription.classifyProblems", + "azure.mgmt.support.operations.ProblemClassificationsOperations.get": "Microsoft.Support.ProblemClassifications.get", + "azure.mgmt.support.aio.operations.ProblemClassificationsOperations.get": "Microsoft.Support.ProblemClassifications.get", + "azure.mgmt.support.operations.ProblemClassificationsOperations.list": "Microsoft.Support.ProblemClassifications.list", + "azure.mgmt.support.aio.operations.ProblemClassificationsOperations.list": "Microsoft.Support.ProblemClassifications.list", + "azure.mgmt.support.operations.CommunicationsOperations.get": "Microsoft.Support.Communications.get", + "azure.mgmt.support.aio.operations.CommunicationsOperations.get": "Microsoft.Support.Communications.get", + "azure.mgmt.support.operations.CommunicationsOperations.begin_create": "Microsoft.Support.Communications.create", + "azure.mgmt.support.aio.operations.CommunicationsOperations.begin_create": "Microsoft.Support.Communications.create", + "azure.mgmt.support.operations.CommunicationsOperations.list": "Microsoft.Support.Communications.list", + "azure.mgmt.support.aio.operations.CommunicationsOperations.list": "Microsoft.Support.Communications.list", + "azure.mgmt.support.operations.CommunicationsOperations.check_name_availability": "Microsoft.Support.SupportTickets.checkNameAvailability", + "azure.mgmt.support.aio.operations.CommunicationsOperations.check_name_availability": "Microsoft.Support.SupportTickets.checkNameAvailability", + "azure.mgmt.support.operations.SupportTicketsOperations.get": "Microsoft.Support.SupportTickets.get", + "azure.mgmt.support.aio.operations.SupportTicketsOperations.get": "Microsoft.Support.SupportTickets.get", + "azure.mgmt.support.operations.SupportTicketsOperations.begin_create": "Microsoft.Support.SupportTickets.create", + "azure.mgmt.support.aio.operations.SupportTicketsOperations.begin_create": "Microsoft.Support.SupportTickets.create", + "azure.mgmt.support.operations.SupportTicketsOperations.update": "Microsoft.Support.SupportTickets.update", + "azure.mgmt.support.aio.operations.SupportTicketsOperations.update": "Microsoft.Support.SupportTickets.update", + "azure.mgmt.support.operations.SupportTicketsOperations.list": "Microsoft.Support.SupportTickets.list", + "azure.mgmt.support.aio.operations.SupportTicketsOperations.list": "Microsoft.Support.SupportTickets.list", + "azure.mgmt.support.operations.SupportTicketsOperations.look_up_resource_id": "Microsoft.Support.SupportTickets.lookUpResourceId", + "azure.mgmt.support.aio.operations.SupportTicketsOperations.look_up_resource_id": "Microsoft.Support.SupportTickets.lookUpResourceId", + "azure.mgmt.support.operations.SupportTicketsOperations.check_name_availability": "Microsoft.Support.SupportTicketsOperationGroup.checkNameAvailability", + "azure.mgmt.support.aio.operations.SupportTicketsOperations.check_name_availability": "Microsoft.Support.SupportTicketsOperationGroup.checkNameAvailability", + "azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations.get": "Microsoft.Support.CommunicationsNoSubscription.get", + "azure.mgmt.support.aio.operations.CommunicationsNoSubscriptionOperations.get": "Microsoft.Support.CommunicationsNoSubscription.get", + "azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations.begin_create": "Microsoft.Support.CommunicationsNoSubscription.create", + "azure.mgmt.support.aio.operations.CommunicationsNoSubscriptionOperations.begin_create": "Microsoft.Support.CommunicationsNoSubscription.create", + "azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations.list": "Microsoft.Support.CommunicationsNoSubscription.list", + "azure.mgmt.support.aio.operations.CommunicationsNoSubscriptionOperations.list": "Microsoft.Support.CommunicationsNoSubscription.list", + "azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations.check_name_availability": "Microsoft.Support.SupportTicketsNoSubscription.checkNameAvailability", + "azure.mgmt.support.aio.operations.CommunicationsNoSubscriptionOperations.check_name_availability": "Microsoft.Support.SupportTicketsNoSubscription.checkNameAvailability", + "azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations.get": "Microsoft.Support.SupportTicketsNoSubscription.get", + "azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations.get": "Microsoft.Support.SupportTicketsNoSubscription.get", + "azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations.begin_create": "Microsoft.Support.SupportTicketsNoSubscription.create", + "azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations.begin_create": "Microsoft.Support.SupportTicketsNoSubscription.create", + "azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations.update": "Microsoft.Support.SupportTicketsNoSubscription.update", + "azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations.update": "Microsoft.Support.SupportTicketsNoSubscription.update", + "azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations.list": "Microsoft.Support.SupportTicketsNoSubscription.list", + "azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations.list": "Microsoft.Support.SupportTicketsNoSubscription.list", + "azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations.check_name_availability": "Microsoft.Support.SupportTicketsNoSubscriptionOperationGroup.checkNameAvailability", + "azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations.check_name_availability": "Microsoft.Support.SupportTicketsNoSubscriptionOperationGroup.checkNameAvailability", + "azure.mgmt.support.operations.ChatTranscriptsOperations.get": "Microsoft.Support.ChatTranscripts.get", + "azure.mgmt.support.aio.operations.ChatTranscriptsOperations.get": "Microsoft.Support.ChatTranscripts.get", + "azure.mgmt.support.operations.ChatTranscriptsOperations.list": "Microsoft.Support.ChatTranscripts.list", + "azure.mgmt.support.aio.operations.ChatTranscriptsOperations.list": "Microsoft.Support.ChatTranscripts.list", + "azure.mgmt.support.operations.ChatTranscriptsNoSubscriptionOperations.get": "Microsoft.Support.ChatTranscriptsNoSubscription.get", + "azure.mgmt.support.aio.operations.ChatTranscriptsNoSubscriptionOperations.get": "Microsoft.Support.ChatTranscriptsNoSubscription.get", + "azure.mgmt.support.operations.ChatTranscriptsNoSubscriptionOperations.list": "Microsoft.Support.ChatTranscriptsNoSubscription.list", + "azure.mgmt.support.aio.operations.ChatTranscriptsNoSubscriptionOperations.list": "Microsoft.Support.ChatTranscriptsNoSubscription.list", + "azure.mgmt.support.operations.FileWorkspacesOperations.get": "Microsoft.Support.FileWorkspaces.get", + "azure.mgmt.support.aio.operations.FileWorkspacesOperations.get": "Microsoft.Support.FileWorkspaces.get", + "azure.mgmt.support.operations.FileWorkspacesOperations.create": "Microsoft.Support.FileWorkspaces.create", + "azure.mgmt.support.aio.operations.FileWorkspacesOperations.create": "Microsoft.Support.FileWorkspaces.create", + "azure.mgmt.support.operations.FileWorkspacesNoSubscriptionOperations.get": "Microsoft.Support.FileWorkspacesNoSubscription.get", + "azure.mgmt.support.aio.operations.FileWorkspacesNoSubscriptionOperations.get": "Microsoft.Support.FileWorkspacesNoSubscription.get", + "azure.mgmt.support.operations.FileWorkspacesNoSubscriptionOperations.create": "Microsoft.Support.FileWorkspacesNoSubscription.create", + "azure.mgmt.support.aio.operations.FileWorkspacesNoSubscriptionOperations.create": "Microsoft.Support.FileWorkspacesNoSubscription.create", + "azure.mgmt.support.operations.FilesOperations.get": "Microsoft.Support.Files.get", + "azure.mgmt.support.aio.operations.FilesOperations.get": "Microsoft.Support.Files.get", + "azure.mgmt.support.operations.FilesOperations.create": "Microsoft.Support.Files.create", + "azure.mgmt.support.aio.operations.FilesOperations.create": "Microsoft.Support.Files.create", + "azure.mgmt.support.operations.FilesOperations.list": "Microsoft.Support.Files.list", + "azure.mgmt.support.aio.operations.FilesOperations.list": "Microsoft.Support.Files.list", + "azure.mgmt.support.operations.FilesOperations.upload": "Microsoft.Support.Files.upload", + "azure.mgmt.support.aio.operations.FilesOperations.upload": "Microsoft.Support.Files.upload", + "azure.mgmt.support.operations.FilesNoSubscriptionOperations.get": "Microsoft.Support.FilesNoSubscription.get", + "azure.mgmt.support.aio.operations.FilesNoSubscriptionOperations.get": "Microsoft.Support.FilesNoSubscription.get", + "azure.mgmt.support.operations.FilesNoSubscriptionOperations.create": "Microsoft.Support.FilesNoSubscription.create", + "azure.mgmt.support.aio.operations.FilesNoSubscriptionOperations.create": "Microsoft.Support.FilesNoSubscription.create", + "azure.mgmt.support.operations.FilesNoSubscriptionOperations.list": "Microsoft.Support.FilesNoSubscription.list", + "azure.mgmt.support.aio.operations.FilesNoSubscriptionOperations.list": "Microsoft.Support.FilesNoSubscription.list", + "azure.mgmt.support.operations.FilesNoSubscriptionOperations.upload": "Microsoft.Support.FilesNoSubscription.upload", + "azure.mgmt.support.aio.operations.FilesNoSubscriptionOperations.upload": "Microsoft.Support.FilesNoSubscription.upload" + }, + "CrossLanguageVersion": "6eb0661461a0" +} \ No newline at end of file diff --git a/sdk/support/azure-mgmt-support/azure/__init__.py b/sdk/support/azure-mgmt-support/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/support/azure-mgmt-support/azure/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py index da1ba13904e9..aa5789314f21 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/__init__.py @@ -2,25 +2,31 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._microsoft_support import MicrosoftSupport +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import SupportMgmtClient # type: ignore from ._version import VERSION __version__ = VERSION try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftSupport", + "SupportMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_client.py similarity index 66% rename from sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py rename to sdk/support/azure-mgmt-support/azure/mgmt/support/_client.py index 5a49fb8ca3bf..86d6310b1f62 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_microsoft_support.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_client.py @@ -2,24 +2,30 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, TYPE_CHECKING +import sys +from typing import Any, Optional, TYPE_CHECKING, cast from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models -from ._configuration import MicrosoftSupportConfiguration -from ._serialization import Deserializer, Serializer +from ._configuration import SupportMgmtClientConfiguration +from ._utils.serialization import Deserializer, Serializer from .operations import ( ChatTranscriptsNoSubscriptionOperations, ChatTranscriptsOperations, + ClassifyProblemsNoSubscriptionOperations, + ClassifyProblemsOperations, + ClassifyServicesNoSubscriptionOperations, + ClassifyServicesOperations, CommunicationsNoSubscriptionOperations, CommunicationsOperations, FileWorkspacesNoSubscriptionOperations, @@ -33,31 +39,46 @@ SupportTicketsOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class SupportMgmtClient: # pylint: disable=too-many-instance-attributes """Microsoft Azure Support Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.support.operations.Operations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.support.operations.ServicesOperations + :ivar classify_services: ClassifyServicesOperations operations + :vartype classify_services: azure.mgmt.support.operations.ClassifyServicesOperations + :ivar classify_services_no_subscription: ClassifyServicesNoSubscriptionOperations operations + :vartype classify_services_no_subscription: + azure.mgmt.support.operations.ClassifyServicesNoSubscriptionOperations + :ivar classify_problems: ClassifyProblemsOperations operations + :vartype classify_problems: azure.mgmt.support.operations.ClassifyProblemsOperations + :ivar classify_problems_no_subscription: ClassifyProblemsNoSubscriptionOperations operations + :vartype classify_problems_no_subscription: + azure.mgmt.support.operations.ClassifyProblemsNoSubscriptionOperations :ivar problem_classifications: ProblemClassificationsOperations operations :vartype problem_classifications: azure.mgmt.support.operations.ProblemClassificationsOperations - :ivar support_tickets: SupportTicketsOperations operations - :vartype support_tickets: azure.mgmt.support.operations.SupportTicketsOperations - :ivar support_tickets_no_subscription: SupportTicketsNoSubscriptionOperations operations - :vartype support_tickets_no_subscription: - azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations :ivar communications: CommunicationsOperations operations :vartype communications: azure.mgmt.support.operations.CommunicationsOperations + :ivar support_tickets: SupportTicketsOperations operations + :vartype support_tickets: azure.mgmt.support.operations.SupportTicketsOperations :ivar communications_no_subscription: CommunicationsNoSubscriptionOperations operations :vartype communications_no_subscription: azure.mgmt.support.operations.CommunicationsNoSubscriptionOperations + :ivar support_tickets_no_subscription: SupportTicketsNoSubscriptionOperations operations + :vartype support_tickets_no_subscription: + azure.mgmt.support.operations.SupportTicketsNoSubscriptionOperations :ivar chat_transcripts: ChatTranscriptsOperations operations :vartype chat_transcripts: azure.mgmt.support.operations.ChatTranscriptsOperations :ivar chat_transcripts_no_subscription: ChatTranscriptsNoSubscriptionOperations operations @@ -72,14 +93,18 @@ 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 - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-07-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -89,10 +114,26 @@ def __init__( self, credential: "TokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - self._config = MicrosoftSupportConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SupportMgmtClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -111,25 +152,36 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() 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.problem_classifications = ProblemClassificationsOperations( + self.classify_services = ClassifyServicesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.support_tickets = SupportTicketsOperations(self._client, self._config, self._serialize, self._deserialize) - self.support_tickets_no_subscription = SupportTicketsNoSubscriptionOperations( + self.classify_services_no_subscription = ClassifyServicesNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.classify_problems = ClassifyProblemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.classify_problems_no_subscription = ClassifyProblemsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.problem_classifications = ProblemClassificationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.communications = CommunicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.support_tickets = SupportTicketsOperations(self._client, self._config, self._serialize, self._deserialize) self.communications_no_subscription = CommunicationsNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) + self.support_tickets_no_subscription = SupportTicketsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.chat_transcripts = ChatTranscriptsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -145,13 +197,13 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request(self, request: HttpRequest, *, stream: bool = False, **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 >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = client._send_request(request) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -164,13 +216,17 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: self._client.close() - def __enter__(self) -> "MicrosoftSupport": + def __enter__(self) -> Self: self._client.__enter__() return self diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py index 9f873d76f422..1c4ab5009d73 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_configuration.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,27 +14,40 @@ from ._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials import TokenCredential -class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for MicrosoftSupport. +class SupportMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for SupportMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-07-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2026-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +56,8 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting 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)) diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_patch.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_patch.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_vendor.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/__init__.py similarity index 50% rename from sdk/support/azure-mgmt-support/azure/mgmt/support/_vendor.py rename to sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/__init__.py index 0dafe0e287ff..8026245c2abc 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_vendor.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/__init__.py @@ -1,16 +1,6 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/model_base.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/model_base.py new file mode 100644 index 000000000000..b93f5120d517 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/model_base.py @@ -0,0 +1,1770 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +from azure.core.rest import HttpResponse + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_duration(td: timedelta, format: typing.Optional[str] = None): + """Serialize a timedelta to its wire representation. + + For the ``seconds``/``milliseconds`` encodings the value is converted to a + numeric value, otherwise it falls back to an ISO 8601 duration string. + + :param timedelta td: The timedelta to serialize. + :param str format: The duration encoding format. + :rtype: int or float or str + :return: serialized duration + """ + seconds = td.total_seconds() + if format == "duration-seconds-int": + return int(seconds) + if format == "duration-seconds-float": + return seconds + if format == "duration-milliseconds-int": + return int(seconds * 1000) + if format == "duration-milliseconds-float": + return seconds * 1000 + return _timedelta_as_isostr(td) + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_duration_numeric(attr, unit): + if isinstance(attr, timedelta): + return attr + return timedelta(**{unit: float(attr)}) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, + "duration-seconds-int": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-seconds-float": functools.partial(_deserialize_duration_numeric, unit="seconds"), + "duration-milliseconds-int": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), + "duration-milliseconds-float": functools.partial(_deserialize_duration_numeric, unit="milliseconds"), +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _serialize_duration(o, format) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass: dict[str, typing.Any] = {} + if args: + if isinstance(args[0], ET.Element): + dict_to_pass.update(self._init_from_xml(args[0])) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) + super().__init__(dict_to_pass) + + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + model_meta = getattr(self, "_xml", {}) + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if rf: + rf._is_optional = True + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._is_optional = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + self._deserializer = deserializer + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + deserializer: typing.Optional[typing.Callable] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + deserializer=deserializer, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) + wrapped_element = _create_xml_element( + element_name, + model_meta.get("prefix"), + _model_ns, + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + _set_xml_attribute(wrapped_element, k, v, prop_meta) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": _dict_ns, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(parent_meta) + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": _items_ns, + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + _meta_ns = _get_xml_ns(meta) if meta else None + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + _safe_register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + if _is_model(deserializer): + return deserializer._deserialize(element, []) + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/serialization.py similarity index 76% rename from sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py rename to sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/serialization.py index 2f781d740827..75906e2eb77f 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_serialization.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_utils/serialization.py @@ -1,30 +1,12 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -# pylint: skip-file # pyright: reportUnnecessaryTypeIgnoreComment=false from base64 import b64decode, b64encode @@ -39,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -48,11 +29,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, - List, - Mapping, ) try: @@ -66,9 +43,13 @@ from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -91,6 +72,8 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: :param data: Input, could be bytes or stream (will be decoded with UTF8) or text :type data: str or bytes or IO :param str content_type: The content type. + :return: The deserialized data. + :rtype: object """ if hasattr(data, "read"): # Assume a stream @@ -112,7 +95,7 @@ def deserialize_from_text(cls, data: Optional[Union[AnyStr, IO]], content_type: try: return json.loads(data_as_str) except ValueError as err: - raise DeserializationError("JSON is invalid: {}".format(err), err) + raise DeserializationError("JSON is invalid: {}".format(err), err) from err elif "xml" in (content_type or []): try: @@ -144,6 +127,8 @@ def _json_attemp(data): # context otherwise. _LOGGER.critical("Wasn't XML not JSON, failing") raise DeserializationError("XML is invalid") from err + elif content_type.startswith("text/"): + return data_as_str raise DeserializationError("Cannot deserialize content-type: {}".format(content_type)) @classmethod @@ -153,6 +138,11 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], Use bytes and headers to NOT use any requests/aiohttp or whatever specific implementation. Headers will tested for "content-type" + + :param bytes body_bytes: The body of the response. + :param dict headers: The headers of the response. + :returns: The deserialized data. + :rtype: object """ # Try to use content-type from headers if available content_type = None @@ -177,80 +167,31 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0.""" - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation.""" - return "Z" - - def dst(self, dt): - """No daylight saving for UTC.""" - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset): - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? None: - self.additional_properties: Optional[Dict[str, Any]] = {} - for k in kwargs: + self.additional_properties: Optional[dict[str, Any]] = {} + for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) elif k in self._validation and self._validation[k].get("readonly", False): @@ -298,13 +246,23 @@ def __init__(self, **kwargs: Any) -> None: setattr(self, k, kwargs[k]) def __eq__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are equal + :rtype: bool + """ if isinstance(other, self.__class__): return self.__dict__ == other.__dict__ return False def __ne__(self, other: Any) -> bool: - """Compare objects by comparing all attributes.""" + """Compare objects by comparing all attributes. + + :param object other: The object to compare + :returns: True if objects are not equal + :rtype: bool + """ return not self.__eq__(other) def __str__(self) -> str: @@ -324,7 +282,11 @@ def is_xml_model(cls) -> bool: @classmethod def _create_xml_node(cls): - """Create XML node.""" + """Create XML node. + + :returns: The XML node + :rtype: xml.etree.ElementTree.Element + """ try: xml_map = cls._xml_map # type: ignore except AttributeError: @@ -344,12 +306,14 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, keep_readonly=keep_readonly, **kwargs + ) def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -378,12 +342,15 @@ def my_key_transformer(key, attr_desc, value): If you want XML serialization, you can pass the kwargs is_xml=True. + :param bool keep_readonly: If you want to serialize the readonly attributes :param function key_transformer: A key transformer function. :returns: A dict JSON compatible object :rtype: dict """ serializer = Serializer(self._infer_class_models()) - return serializer._serialize(self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs) # type: ignore + return serializer._serialize( # type: ignore # pylint: disable=protected-access + self, key_transformer=key_transformer, keep_readonly=keep_readonly, **kwargs + ) @classmethod def _infer_class_models(cls): @@ -393,30 +360,31 @@ def _infer_class_models(cls): client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} if cls.__name__ not in client_models: raise ValueError("Not Autorest generated code") - except Exception: + except Exception: # pylint: disable=broad-exception-caught # Assume it's not Autorest generated (tests?). Add ourselves as dependencies. client_models = {cls.__name__: cls} return client_models @classmethod - def deserialize(cls: Type[ModelType], data: Any, content_type: Optional[str] = None) -> ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -424,9 +392,11 @@ def from_dict( and last_rest_key_case_insensitive_extractor) :param dict data: A dict using RestAPI structure + :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -446,21 +416,25 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod def _classify(cls, response, objects): """Check the class _subtype_map for any child classes. We want to ignore any inherited _subtype_maps. - Remove the polymorphic key from the initial data. + + :param dict response: The initial data + :param dict objects: The class objects + :returns: The class to be used + :rtype: class """ for subtype_key in cls.__dict__.get("_subtype_map", {}).keys(): subtype_value = None if not isinstance(response, ET.Element): rest_api_response_key = cls._get_rest_key_parts(subtype_key)[-1] - subtype_value = response.pop(rest_api_response_key, None) or response.pop(subtype_key, None) + subtype_value = response.get(rest_api_response_key, None) or response.get(subtype_key, None) else: subtype_value = xml_key_extractor(subtype_key, cls._attribute_map[subtype_key], response) if subtype_value: @@ -499,11 +473,13 @@ def _decode_attribute_map_key(key): inside the received data. :param str key: A key string from the generated code + :returns: The decoded key + :rtype: str """ return key.replace("\\.", ".") -class Serializer(object): +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -538,12 +514,16 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, "unix-time": Serializer.serialize_unix, "duration": Serializer.serialize_duration, + "duration-seconds-int": Serializer.serialize_duration_seconds_int, + "duration-seconds-float": Serializer.serialize_duration_seconds_float, + "duration-milliseconds-int": Serializer.serialize_duration_milliseconds_int, + "duration-milliseconds-float": Serializer.serialize_duration_milliseconds_float, "date": Serializer.serialize_date, "time": Serializer.serialize_time, "decimal": Serializer.serialize_decimal, @@ -554,17 +534,20 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = 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 - def _serialize(self, target_obj, data_type=None, **kwargs): + def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, too-many-statements, too-many-locals + self, target_obj, data_type=None, **kwargs + ): """Serialize data into a string according to type. - :param target_obj: The data to be serialized. + :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. + :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) keep_readonly = kwargs.get("keep_readonly", False) @@ -590,17 +573,19 @@ def _serialize(self, target_obj, data_type=None, **kwargs): serialized = {} if is_xml_model_serialization: - serialized = target_obj._create_xml_node() + serialized = target_obj._create_xml_node() # pylint: disable=protected-access try: - attributes = target_obj._attribute_map + attributes = target_obj._attribute_map # pylint: disable=protected-access for attr, attr_desc in attributes.items(): attr_name = attr - if not keep_readonly and target_obj._validation.get(attr_name, {}).get("readonly", False): + if not keep_readonly and target_obj._validation.get( # pylint: disable=protected-access + attr_name, {} + ).get("readonly", False): continue if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -631,7 +616,8 @@ def _serialize(self, target_obj, data_type=None, **kwargs): if isinstance(new_attr, list): serialized.extend(new_attr) # type: ignore elif isinstance(new_attr, ET.Element): - # If the down XML has no XML/Name, we MUST replace the tag with the local tag. But keeping the namespaces. + # If the down XML has no XML/Name, + # we MUST replace the tag with the local tag. But keeping the namespaces. if "name" not in getattr(orig_attr, "_xml_map", {}): splitted_tag = new_attr.tag.split("}") if len(splitted_tag) == 2: # Namespace @@ -662,17 +648,17 @@ def _serialize(self, target_obj, data_type=None, **kwargs): except (AttributeError, KeyError, TypeError) as err: msg = "Attribute {} in object {} cannot be serialized.\n{}".format(attr_name, class_name, str(target_obj)) raise SerializationError(msg) from err - else: - return serialized + return serialized def body(self, data, data_type, **kwargs): """Serialize data intended for a request body. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized request body """ # Just in case this is a dict @@ -701,7 +687,7 @@ def body(self, data, data_type, **kwargs): attribute_key_case_insensitive_extractor, last_rest_key_case_insensitive_extractor, ] - data = deserializer._deserialize(data_type, data) + data = deserializer._deserialize(data_type, data) # pylint: disable=protected-access except DeserializationError as err: raise SerializationError("Unable to build a model: " + str(err)) from err @@ -710,11 +696,13 @@ def body(self, data, data_type, **kwargs): def url(self, name, data, data_type, **kwargs): """Serialize data intended for a URL path. - :param data: The data to be serialized. + :param str name: The name of the URL path parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :returns: The serialized URL path + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -726,21 +714,20 @@ def url(self, name, data, data_type, **kwargs): output = output.replace("{", quote("{")).replace("}", quote("}")) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return output + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return output def query(self, name, data, data_type, **kwargs): """Serialize data intended for a URL query. - :param data: The data to be serialized. + :param str name: The name of the query parameter. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :keyword bool skip_quote: Whether to skip quote the serialized result. - Defaults to False. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized query parameter """ try: # Treat the list aside, since we don't want to encode the div separator @@ -757,19 +744,20 @@ def query(self, name, data, data_type, **kwargs): output = str(output) else: output = quote(str(output), safe="") - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def header(self, name, data, data_type, **kwargs): """Serialize data intended for a request header. - :param data: The data to be serialized. + :param str name: The name of the header. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None + :returns: The serialized header """ try: if data_type in ["[str]"]: @@ -778,21 +766,20 @@ def header(self, name, data, data_type, **kwargs): output = self.serialize_data(data, data_type, **kwargs) if data_type == "bool": output = json.dumps(output) - except SerializationError: - raise TypeError("{} must be type {}.".format(name, data_type)) - else: - return str(output) + except SerializationError as exc: + raise TypeError("{} must be type {}.".format(name, data_type)) from exc + return str(output) def serialize_data(self, data, data_type, **kwargs): """Serialize generic data according to supplied data type. - :param data: The data to be serialized. + :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :param bool required: Whether it's essential that the data not be - empty or None - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. + :returns: The serialized data. + :rtype: str, int, float, bool, dict, list """ if data is None: raise ValueError("No value for given attribute") @@ -803,12 +790,12 @@ def serialize_data(self, data, data_type, **kwargs): if data_type in self.basic_types.values(): return self.serialize_basic(data, data_type, **kwargs) - elif data_type in self.serialize_type: + if data_type in self.serialize_type: return self.serialize_type[data_type](data, **kwargs) # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -819,11 +806,10 @@ def serialize_data(self, data, data_type, **kwargs): except (ValueError, TypeError) as err: msg = "Unable to serialize value: {!r} as type: {!r}." raise SerializationError(msg.format(data, data_type)) from err - else: - return self._serialize(data, **kwargs) + return self._serialize(data, **kwargs) @classmethod - def _get_custom_serializers(cls, data_type, **kwargs): + def _get_custom_serializers(cls, data_type, **kwargs): # pylint: disable=inconsistent-return-statements custom_serializer = kwargs.get("basic_types_serializers", {}).get(data_type) if custom_serializer: return custom_serializer @@ -839,23 +825,33 @@ def serialize_basic(cls, data, data_type, **kwargs): - basic_types_serializers dict[str, callable] : If set, use the callable as serializer - is_xml bool : If set, use xml_basic_types_serializers - :param data: Object to be serialized. + :param obj data: Object to be serialized. :param str data_type: Type of object in the iterable. + :rtype: str, int, float, bool + :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): """Special handling for serializing unicode strings in Py2. Encode to UTF-8 if unicode, otherwise handle as a str. - :param data: Object to be serialized. + :param str data: Object to be serialized. :rtype: str + :return: serialized object """ try: # If I received an enum, return its value return data.value @@ -869,8 +865,7 @@ def serialize_unicode(cls, data): return data except NameError: return str(data) - else: - return str(data) + return str(data) def serialize_iter(self, data, iter_type, div=None, **kwargs): """Serialize iterable. @@ -880,15 +875,13 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): serialization_ctxt['type'] should be same as data_type. - is_xml bool : If set, serialize as XML - :param list attr: Object to be serialized. + :param list data: Object to be serialized. :param str iter_type: Type of object in the iterable. - :param bool required: Whether the objects in the iterable must - not be None or empty. :param str div: If set, this str will be used to combine the elements in the iterable into a combined string. Default is 'None'. - :keyword bool do_quote: Whether to quote the serialized result of each iterable element. Defaults to False. :rtype: list, str + :return: serialized iterable """ if isinstance(data, str): raise SerializationError("Refuse str type as a valid iter type.") @@ -943,9 +936,8 @@ def serialize_dict(self, attr, dict_type, **kwargs): :param dict attr: Object to be serialized. :param str dict_type: Type of object in the dictionary. - :param bool required: Whether the objects in the dictionary must - not be None or empty. :rtype: dict + :return: serialized dictionary """ serialization_ctxt = kwargs.get("serialization_ctxt", {}) serialized = {} @@ -969,7 +961,7 @@ def serialize_dict(self, attr, dict_type, **kwargs): return serialized - def serialize_object(self, attr, **kwargs): + def serialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Serialize a generic object. This will be handled as a dictionary. If object passed in is not a basic type (str, int, float, dict, list) it will simply be @@ -977,6 +969,7 @@ def serialize_object(self, attr, **kwargs): :param dict attr: Object to be serialized. :rtype: dict or str + :return: serialized object """ if attr is None: return None @@ -1001,7 +994,7 @@ def serialize_object(self, attr, **kwargs): return self.serialize_decimal(attr) # If it's a model or I know this dependency, serialize as a Model - elif obj_type in self.dependencies.values() or isinstance(attr, Model): + if obj_type in self.dependencies.values() or isinstance(attr, Model): return self._serialize(attr) if obj_type == dict: @@ -1032,56 +1025,61 @@ def serialize_enum(attr, enum_obj=None): try: enum_obj(result) # type: ignore return result - except ValueError: + except ValueError as exc: for enum_value in enum_obj: # type: ignore if enum_value.value.lower() == str(attr).lower(): return enum_value.value error = "{!r} is not valid value for enum {!r}" - raise SerializationError(error.format(attr, enum_obj)) + raise SerializationError(error.format(attr, enum_obj)) from exc @staticmethod - def serialize_bytearray(attr, **kwargs): + def serialize_bytearray(attr, **kwargs): # pylint: disable=unused-argument """Serialize bytearray into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ return b64encode(attr).decode() @staticmethod - def serialize_base64(attr, **kwargs): + def serialize_base64(attr, **kwargs): # pylint: disable=unused-argument """Serialize str into base-64 string. - :param attr: Object to be serialized. + :param str attr: Object to be serialized. :rtype: str + :return: serialized base64 """ encoded = b64encode(attr).decode("ascii") return encoded.strip("=").replace("+", "-").replace("/", "_") @staticmethod - def serialize_decimal(attr, **kwargs): + def serialize_decimal(attr, **kwargs): # pylint: disable=unused-argument """Serialize Decimal object to float. - :param attr: Object to be serialized. + :param decimal attr: Object to be serialized. :rtype: float + :return: serialized decimal """ return float(attr) @staticmethod - def serialize_long(attr, **kwargs): + def serialize_long(attr, **kwargs): # pylint: disable=unused-argument """Serialize long (Py2) or int (Py3). - :param attr: Object to be serialized. + :param int attr: Object to be serialized. :rtype: int/long + :return: serialized long """ return _long_type(attr) @staticmethod - def serialize_date(attr, **kwargs): + def serialize_date(attr, **kwargs): # pylint: disable=unused-argument """Serialize Date object into ISO-8601 formatted string. :param Date attr: Object to be serialized. :rtype: str + :return: serialized date """ if isinstance(attr, str): attr = isodate.parse_date(attr) @@ -1089,11 +1087,12 @@ def serialize_date(attr, **kwargs): return t @staticmethod - def serialize_time(attr, **kwargs): + def serialize_time(attr, **kwargs): # pylint: disable=unused-argument """Serialize Time object into ISO-8601 formatted string. :param datetime.time attr: Object to be serialized. :rtype: str + :return: serialized time """ if isinstance(attr, str): attr = isodate.parse_time(attr) @@ -1103,30 +1102,87 @@ def serialize_time(attr, **kwargs): return t @staticmethod - def serialize_duration(attr, **kwargs): + def serialize_duration(attr, **kwargs): # pylint: disable=unused-argument """Serialize TimeDelta object into ISO-8601 formatted string. :param TimeDelta attr: Object to be serialized. :rtype: str + :return: serialized duration """ if isinstance(attr, str): attr = isodate.parse_duration(attr) return isodate.duration_isoformat(attr) @staticmethod - def serialize_rfc(attr, **kwargs): + def _serialize_duration_numeric(attr, scale, as_int): + """Serialize a TimeDelta into a numeric value scaled to the wire unit. + + :param TimeDelta attr: Object to be serialized. + :param int scale: Multiplier applied to total seconds (1 for seconds, 1000 for milliseconds). + :param bool as_int: Whether to truncate the result to an int. + :rtype: int or float + :return: serialized duration + """ + if isinstance(attr, str): + attr = isodate.parse_duration(attr) + value = attr.total_seconds() * scale if isinstance(attr, datetime.timedelta) else attr + return int(value) if as_int else float(value) + + @staticmethod + def serialize_duration_seconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, True) + + @staticmethod + def serialize_duration_seconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of seconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1, False) + + @staticmethod + def serialize_duration_milliseconds_int(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into an integer number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: int + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, True) + + @staticmethod + def serialize_duration_milliseconds_float(attr, **kwargs): # pylint: disable=unused-argument + """Serialize TimeDelta object into a floating point number of milliseconds. + + :param TimeDelta attr: Object to be serialized. + :rtype: float + :return: serialized duration + """ + return Serializer._serialize_duration_numeric(attr, 1000, False) + + @staticmethod + def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into RFC-1123 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. + :return: serialized rfc """ try: if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") utc = attr.utctimetuple() - except AttributeError: - raise TypeError("RFC1123 object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("RFC1123 object must be valid Datetime object.") from exc return "{}, {:02} {} {:04} {:02}:{:02}:{:02} GMT".format( Serializer.days[utc.tm_wday], @@ -1139,12 +1195,13 @@ def serialize_rfc(attr, **kwargs): ) @staticmethod - def serialize_iso(attr, **kwargs): + def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into ISO-8601 formatted string. :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. + :return: serialized iso """ if isinstance(attr, str): attr = isodate.parse_datetime(attr) @@ -1170,13 +1227,14 @@ def serialize_iso(attr, **kwargs): raise TypeError(msg) from err @staticmethod - def serialize_unix(attr, **kwargs): + def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument """Serialize Datetime object into IntTime format. This is represented as seconds. :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid + :return: serialied unix """ if isinstance(attr, int): return attr @@ -1184,17 +1242,17 @@ def serialize_unix(attr, **kwargs): if not attr.tzinfo: _LOGGER.warning("Datetime with no tzinfo will be considered UTC.") return int(calendar.timegm(attr.utctimetuple())) - except AttributeError: - raise TypeError("Unix time object must be valid Datetime object.") + except AttributeError as exc: + raise TypeError("Unix time object must be valid Datetime object.") from exc -def rest_key_extractor(attr, attr_desc, data): +def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument key = attr_desc["key"] working_data = data while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1209,7 +1267,9 @@ def rest_key_extractor(attr, attr_desc, data): return working_data.get(key) -def rest_key_case_insensitive_extractor(attr, attr_desc, data): +def rest_key_case_insensitive_extractor( # pylint: disable=unused-argument, inconsistent-return-statements + attr, attr_desc, data +): key = attr_desc["key"] working_data = data @@ -1230,17 +1290,29 @@ def rest_key_case_insensitive_extractor(attr, attr_desc, data): return attribute_key_case_insensitive_extractor(key, None, working_data) -def last_rest_key_extractor(attr, attr_desc, data): - """Extract the attribute in "data" based on the last part of the JSON path key.""" +def last_rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument + """Extract the attribute in "data" based on the last part of the JSON path key. + + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute + """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) return attribute_key_extractor(dict_keys[-1], None, data) -def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): +def last_rest_key_case_insensitive_extractor(attr, attr_desc, data): # pylint: disable=unused-argument """Extract the attribute in "data" based on the last part of the JSON path key. This is the case insensitive version of "last_rest_key_extractor" + :param str attr: The attribute to extract + :param dict attr_desc: The attribute description + :param dict data: The data to extract from + :rtype: object + :returns: The extracted attribute """ key = attr_desc["key"] dict_keys = _FLATTEN.split(key) @@ -1277,7 +1349,7 @@ def _extract_name_from_internal_type(internal_type): return xml_name -def xml_key_extractor(attr, attr_desc, data): +def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument,too-many-return-statements if isinstance(data, dict): return None @@ -1329,22 +1401,21 @@ def xml_key_extractor(attr, attr_desc, data): if is_iter_type: if is_wrapped: return None # is_wrapped no node, we want None - else: - return [] # not wrapped, assume empty list + return [] # not wrapped, assume empty list return None # Assume it's not there, maybe an optional node. # If is_iter_type and not wrapped, return all found children if is_iter_type: if not is_wrapped: return children - else: # Iter and wrapped, should have found one node only (the wrap one) - if len(children) != 1: - raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( - xml_name - ) + # Iter and wrapped, should have found one node only (the wrap one) + if len(children) != 1: + raise DeserializationError( + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( + xml_name ) - return list(children[0]) # Might be empty list and that's ok. + ) + return list(children[0]) # Might be empty list and that's ok. # Here it's not a itertype, we should have found one element only or empty if len(children) > 1: @@ -1352,7 +1423,7 @@ def xml_key_extractor(attr, attr_desc, data): return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1361,14 +1432,18 @@ class Deserializer(object): basic_types = {str: "str", int: "int", bool: "bool", float: "float"} - valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") + valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]] = None): + def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, "unix-time": Deserializer.deserialize_unix, "duration": Deserializer.deserialize_duration, + "duration-seconds-int": Deserializer.deserialize_duration_seconds, + "duration-seconds-float": Deserializer.deserialize_duration_seconds, + "duration-milliseconds-int": Deserializer.deserialize_duration_milliseconds, + "duration-milliseconds-float": Deserializer.deserialize_duration_milliseconds, "date": Deserializer.deserialize_date, "time": Deserializer.deserialize_time, "decimal": Deserializer.deserialize_decimal, @@ -1381,9 +1456,13 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): } self.deserialize_expected_types = { "duration": (isodate.Duration, datetime.timedelta), + "duration-seconds-int": (isodate.Duration, datetime.timedelta), + "duration-seconds-float": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-int": (isodate.Duration, datetime.timedelta), + "duration-milliseconds-float": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = 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 @@ -1393,33 +1472,56 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None): # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) - def _deserialize(self, target_obj, data): + def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return-statements """Call the deserializer on a model. Data needs to be already deserialized as JSON or XML ElementTree :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ # This is already a model, go recursive just in case if hasattr(data, "_attribute_map"): constants = [name for name, config in getattr(data, "_validation", {}).items() if config.get("constant")] try: - for attr, mapconfig in data._attribute_map.items(): + for attr, mapconfig in data._attribute_map.items(): # pylint: disable=protected-access if attr in constants: continue value = getattr(data, attr) @@ -1438,13 +1540,13 @@ def _deserialize(self, target_obj, data): if isinstance(response, str): return self.deserialize_data(data, response) - elif isinstance(response, type) and issubclass(response, Enum): + if isinstance(response, type) and issubclass(response, Enum): return self.deserialize_enum(data, response) - if data is None: + if data is None or data is CoreNull: return data try: - attributes = response._attribute_map # type: ignore + attributes = response._attribute_map # type: ignore # pylint: disable=protected-access d_attrs = {} for attr, attr_desc in attributes.items(): # Check empty string. If it's not empty, someone has a real "additionalProperties"... @@ -1474,9 +1576,8 @@ def _deserialize(self, target_obj, data): except (AttributeError, TypeError, KeyError) as err: msg = "Unable to deserialize to object: " + class_name # type: ignore raise DeserializationError(msg) from err - else: - additional_properties = self._build_additional_properties(attributes, data) - return self._instantiate_model(response, d_attrs, additional_properties) + additional_properties = self._build_additional_properties(attributes, data) + return self._instantiate_model(response, d_attrs, additional_properties) def _build_additional_properties(self, attribute_map, data): if not self.additional_properties_detection: @@ -1503,6 +1604,8 @@ def _classify_target(self, target, data): :param str target: The target object type to deserialize to. :param str/dict data: The response data to deserialize. + :return: The classified target object and its class name. + :rtype: tuple """ if target is None: return None, None @@ -1514,7 +1617,7 @@ def _classify_target(self, target, data): return target, target try: - target = target._classify(data, self.dependencies) # type: ignore + target = target._classify(data, self.dependencies) # type: ignore # pylint: disable=protected-access except AttributeError: pass # Target is not a Model, no classify return target, target.__class__.__name__ # type: ignore @@ -1529,10 +1632,12 @@ def failsafe_deserialize(self, target_obj, data, content_type=None): :param str target_obj: The target object type to deserialize to. :param str/dict data: The response data to deserialize. :param str content_type: Swagger "produces" if available. + :return: Deserialized object. + :rtype: object """ try: return self(target_obj, data, content_type=content_type) - except: + except: # pylint: disable=bare-except _LOGGER.debug( "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True ) @@ -1550,10 +1655,12 @@ def _unpack_content(raw_data, content_type=None): If raw_data is something else, bypass all logic and return it directly. - :param raw_data: Data to be processed. - :param content_type: How to parse if raw_data is a string/bytes. + :param obj raw_data: Data to be processed. + :param str content_type: How to parse if raw_data is a string/bytes. :raises JSONDecodeError: If JSON is requested and parsing is impossible. :raises UnicodeDecodeError: If bytes is not UTF8 + :rtype: object + :return: Unpacked content. """ # Assume this is enough to detect a Pipeline Response without importing it context = getattr(raw_data, "context", {}) @@ -1577,24 +1684,35 @@ def _unpack_content(raw_data, content_type=None): def _instantiate_model(self, response, attrs, additional_properties=None): """Instantiate a response model passing in deserialized args. - :param response: The response model class. - :param d_attrs: The deserialized response attributes. + :param Response response: The response model class. + :param dict attrs: The deserialized response attributes. + :param dict additional_properties: Additional properties to be set. + :rtype: Response + :return: The instantiated response model. """ if callable(response): subtype = getattr(response, "_subtype_map", {}) try: - readonly = [k for k, v in response._validation.items() if v.get("readonly")] - const = [k for k, v in response._validation.items() if v.get("constant")] + readonly = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") + ] + const = [ + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") + ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore - raise DeserializationError(msg + str(err)) + raise DeserializationError(msg + str(err)) from err else: try: for attr, value in attrs.items(): @@ -1603,15 +1721,16 @@ def _instantiate_model(self, response, attrs, additional_properties=None): except Exception as exp: msg = "Unable to populate response model. " msg += "Type: {}, Error: {}".format(type(response), exp) - raise DeserializationError(msg) + raise DeserializationError(msg) from exp - def deserialize_data(self, data, data_type): + def deserialize_data(self, data, data_type): # pylint: disable=too-many-return-statements """Process data for deserialization according to data type. :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. + :rtype: object """ if data is None: return data @@ -1625,7 +1744,11 @@ def deserialize_data(self, data, data_type): if isinstance(data, self.deserialize_expected_types.get(data_type, tuple())): return data - is_a_text_parsing_type = lambda x: x not in ["object", "[]", r"{}"] + is_a_text_parsing_type = lambda x: x not in [ # pylint: disable=unnecessary-lambda-assignment + "object", + "[]", + r"{}", + ] if isinstance(data, ET.Element) and is_a_text_parsing_type(data_type) and not data.text: return None data_val = self.deserialize_type[data_type](data) @@ -1645,14 +1768,14 @@ def deserialize_data(self, data, data_type): msg = "Unable to deserialize response data." msg += " Data: {}, {}".format(data, data_type) raise DeserializationError(msg) from err - else: - return self._deserialize(obj_type, data) + return self._deserialize(obj_type, data) def deserialize_iter(self, attr, iter_type): """Deserialize an iterable. :param list attr: Iterable to be deserialized. :param str iter_type: The type of object in the iterable. + :return: Deserialized iterable. :rtype: list """ if attr is None: @@ -1669,6 +1792,7 @@ def deserialize_dict(self, attr, dict_type): :param dict/list attr: Dictionary to be deserialized. Also accepts a list of key, value pairs. :param str dict_type: The object type of the items in the dictionary. + :return: Deserialized dictionary. :rtype: dict """ if isinstance(attr, list): @@ -1679,13 +1803,14 @@ def deserialize_dict(self, attr, dict_type): attr = {el.tag: el.text for el in attr} return {k: self.deserialize_data(v, dict_type) for k, v in attr.items()} - def deserialize_object(self, attr, **kwargs): + def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return-statements """Deserialize a generic object. This will be handled as a dictionary. :param dict attr: Dictionary to be deserialized. + :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1718,11 +1843,10 @@ def deserialize_object(self, attr, **kwargs): pass return deserialized - else: - error = "Cannot deserialize generic object with type: " - raise TypeError(error + str(obj_type)) + error = "Cannot deserialize generic object with type: " + raise TypeError(error + str(obj_type)) - def deserialize_basic(self, attr, data_type): + def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return-statements """Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as @@ -1730,8 +1854,9 @@ def deserialize_basic(self, attr, data_type): :param str attr: response string to be deserialized. :param str data_type: deserialization data type. + :return: Deserialized basic type. :rtype: str, int, float or bool - :raises: TypeError if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1741,24 +1866,27 @@ def deserialize_basic(self, attr, data_type): if data_type == "str": # None or '', node is empty string. return "" - else: - # None or '', node with a strong type is None. - # Don't try to model "empty bool" or "empty int" - return None + # None or '', node with a strong type is None. + # Don't try to model "empty bool" or "empty int" + return None if data_type == "bool": if attr in [True, False, 1, 0]: return bool(attr) - elif isinstance(attr, str): + if isinstance(attr, str): if attr.lower() in ["true", "1"]: return True - elif attr.lower() in ["false", "0"]: + if attr.lower() in ["false", "0"]: return False raise TypeError("Invalid boolean value: {}".format(attr)) if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): @@ -1766,6 +1894,7 @@ def deserialize_unicode(data): as a string. :param str data: response string to be deserialized. + :return: Deserialized string. :rtype: str or unicode """ # We might be here because we have an enum modeled as string, @@ -1779,8 +1908,7 @@ def deserialize_unicode(data): return data except NameError: return str(data) - else: - return str(data) + return str(data) @staticmethod def deserialize_enum(data, enum_obj): @@ -1792,6 +1920,7 @@ def deserialize_enum(data, enum_obj): :param str data: Response string to be deserialized. If this value is None or invalid it will be returned as-is. :param Enum enum_obj: Enum object to deserialize to. + :return: Deserialized enum object. :rtype: Enum """ if isinstance(data, enum_obj) or data is None: @@ -1802,9 +1931,9 @@ def deserialize_enum(data, enum_obj): # Workaround. We might consider remove it in the future. try: return list(enum_obj.__members__.values())[data] - except IndexError: + except IndexError as exc: error = "{!r} is not a valid index for enum {!r}" - raise DeserializationError(error.format(data, enum_obj)) + raise DeserializationError(error.format(data, enum_obj)) from exc try: return enum_obj(str(data)) except ValueError: @@ -1820,8 +1949,9 @@ def deserialize_bytearray(attr): """Deserialize string into bytearray. :param str attr: response string to be deserialized. + :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1832,8 +1962,9 @@ def deserialize_base64(attr): """Deserialize base64 encoded string into string. :param str attr: response string to be deserialized. + :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1847,8 +1978,9 @@ def deserialize_decimal(attr): """Deserialize string into Decimal object. :param str attr: response string to be deserialized. - :rtype: Decimal - :raises: DeserializationError if string format invalid. + :return: Deserialized decimal + :raises DeserializationError: if string format invalid. + :rtype: decimal """ if isinstance(attr, ET.Element): attr = attr.text @@ -1863,8 +1995,9 @@ def deserialize_long(attr): """Deserialize string into long (Py2) or int (Py3). :param str attr: response string to be deserialized. + :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1875,8 +2008,9 @@ def deserialize_duration(attr): """Deserialize ISO-8601 formatted string into TimeDelta object. :param str attr: response string to be deserialized. + :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1885,16 +2019,58 @@ def deserialize_duration(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize duration object." raise DeserializationError(msg) from err - else: - return duration + return duration + + @staticmethod + def _deserialize_duration_numeric(attr, unit): + """Deserialize a numeric duration value into a TimeDelta object. + + :param float attr: response value to be deserialized. + :param str unit: The wire unit, used as the ``timedelta`` keyword + (``"seconds"`` or ``"milliseconds"``). + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + if isinstance(attr, ET.Element): + attr = attr.text + try: + duration = datetime.timedelta(**{unit: float(attr)}) # type: ignore + except (ValueError, OverflowError, TypeError) as err: + msg = "Cannot deserialize duration object." + raise DeserializationError(msg) from err + return duration + + @staticmethod + def deserialize_duration_seconds(attr): + """Deserialize a numeric number of seconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "seconds") + + @staticmethod + def deserialize_duration_milliseconds(attr): + """Deserialize a numeric number of milliseconds into a TimeDelta object. + + :param float attr: response value to be deserialized. + :return: Deserialized duration + :rtype: TimeDelta + :raises DeserializationError: if value is invalid. + """ + return Deserializer._deserialize_duration_numeric(attr, "milliseconds") @staticmethod def deserialize_date(attr): """Deserialize ISO-8601 formatted string into Date object. :param str attr: response string to be deserialized. + :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1908,8 +2084,9 @@ def deserialize_time(attr): """Deserialize ISO-8601 formatted string into time object. :param str attr: response string to be deserialized. + :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1922,31 +2099,32 @@ def deserialize_rfc(attr): """Deserialize RFC-1123 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) except ValueError as err: msg = "Cannot deserialize to rfc datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_iso(attr): """Deserialize ISO-8601 formatted string into Datetime object. :param str attr: response string to be deserialized. + :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1974,8 +2152,7 @@ def deserialize_iso(attr): except (ValueError, OverflowError, AttributeError) as err: msg = "Cannot deserialize datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj @staticmethod def deserialize_unix(attr): @@ -1983,8 +2160,9 @@ def deserialize_unix(attr): This is represented as seconds. :param int attr: Object to be serialized. + :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore @@ -1994,5 +2172,4 @@ def deserialize_unix(attr): except ValueError as err: msg = "Cannot deserialize to unix datetime object." raise DeserializationError(msg) from err - else: - return date_obj + return date_obj diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_validation.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_validation.py new file mode 100644 index 000000000000..f5af3a4eb8a2 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_validation.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import functools + + +def api_version_validation(**kwargs): + params_added_on = kwargs.pop("params_added_on", {}) + method_added_on = kwargs.pop("method_added_on", "") + api_versions_list = kwargs.pop("api_versions_list", []) + + def _index_with_default(value: str, default: int = -1) -> int: + """Get the index of value in lst, or return default if not found. + + :param value: The value to search for in the api_versions_list. + :type value: str + :param default: The default value to return if the value is not found. + :type default: int + :return: The index of the value in the list, or the default value if not found. + :rtype: int + """ + try: + return api_versions_list.index(value) + except ValueError: + return default + + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + try: + # this assumes the client has an _api_version attribute + client = args[0] + client_api_version = client._config.api_version # pylint: disable=protected-access + except AttributeError: + return func(*args, **kwargs) + + if _index_with_default(method_added_on) > _index_with_default(client_api_version): + raise ValueError( + f"'{func.__name__}' is not available in API version " + f"{client_api_version}. Pass service API version {method_added_on} or newer to your client." + ) + + unsupported = { + parameter: api_version + for api_version, parameters in params_added_on.items() + for parameter in parameters + if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version) + } + if unsupported: + raise ValueError( + "".join( + [ + f"'{param}' is not available in API version {client_api_version}. " + f"Use service API version {version} or newer.\n" + for param, version in unsupported.items() + ] + ) + ) + return func(*args, **kwargs) + + return wrapper + + return decorator diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py index 364f3c906cf9..57926944c575 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/_version.py @@ -2,8 +2,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "8.0.0" diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py index 84840d00d4b1..1143e55cbcc7 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/__init__.py @@ -2,22 +2,28 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._microsoft_support import MicrosoftSupport +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._client import SupportMgmtClient # type: ignore try: from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import + from ._patch import * except ImportError: _patch_all = [] from ._patch import patch_sdk as _patch_sdk __all__ = [ - "MicrosoftSupport", + "SupportMgmtClient", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_microsoft_support.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_client.py similarity index 67% rename from sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_microsoft_support.py rename to sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_client.py index 2c4642859e08..06e77b24825f 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_microsoft_support.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_client.py @@ -2,24 +2,30 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING +import sys +from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import MicrosoftSupportConfiguration +from .._utils.serialization import Deserializer, Serializer +from ._configuration import SupportMgmtClientConfiguration from .operations import ( ChatTranscriptsNoSubscriptionOperations, ChatTranscriptsOperations, + ClassifyProblemsNoSubscriptionOperations, + ClassifyProblemsOperations, + ClassifyServicesNoSubscriptionOperations, + ClassifyServicesOperations, CommunicationsNoSubscriptionOperations, CommunicationsOperations, FileWorkspacesNoSubscriptionOperations, @@ -33,31 +39,46 @@ SupportTicketsOperations, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftSupport: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class SupportMgmtClient: # pylint: disable=too-many-instance-attributes """Microsoft Azure Support Resource Provider. :ivar operations: Operations operations :vartype operations: azure.mgmt.support.aio.operations.Operations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.support.aio.operations.ServicesOperations + :ivar classify_services: ClassifyServicesOperations operations + :vartype classify_services: azure.mgmt.support.aio.operations.ClassifyServicesOperations + :ivar classify_services_no_subscription: ClassifyServicesNoSubscriptionOperations operations + :vartype classify_services_no_subscription: + azure.mgmt.support.aio.operations.ClassifyServicesNoSubscriptionOperations + :ivar classify_problems: ClassifyProblemsOperations operations + :vartype classify_problems: azure.mgmt.support.aio.operations.ClassifyProblemsOperations + :ivar classify_problems_no_subscription: ClassifyProblemsNoSubscriptionOperations operations + :vartype classify_problems_no_subscription: + azure.mgmt.support.aio.operations.ClassifyProblemsNoSubscriptionOperations :ivar problem_classifications: ProblemClassificationsOperations operations :vartype problem_classifications: azure.mgmt.support.aio.operations.ProblemClassificationsOperations - :ivar support_tickets: SupportTicketsOperations operations - :vartype support_tickets: azure.mgmt.support.aio.operations.SupportTicketsOperations - :ivar support_tickets_no_subscription: SupportTicketsNoSubscriptionOperations operations - :vartype support_tickets_no_subscription: - azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations :ivar communications: CommunicationsOperations operations :vartype communications: azure.mgmt.support.aio.operations.CommunicationsOperations + :ivar support_tickets: SupportTicketsOperations operations + :vartype support_tickets: azure.mgmt.support.aio.operations.SupportTicketsOperations :ivar communications_no_subscription: CommunicationsNoSubscriptionOperations operations :vartype communications_no_subscription: azure.mgmt.support.aio.operations.CommunicationsNoSubscriptionOperations + :ivar support_tickets_no_subscription: SupportTicketsNoSubscriptionOperations operations + :vartype support_tickets_no_subscription: + azure.mgmt.support.aio.operations.SupportTicketsNoSubscriptionOperations :ivar chat_transcripts: ChatTranscriptsOperations operations :vartype chat_transcripts: azure.mgmt.support.aio.operations.ChatTranscriptsOperations :ivar chat_transcripts_no_subscription: ChatTranscriptsNoSubscriptionOperations operations @@ -72,14 +93,18 @@ 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 - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-07-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. @@ -89,10 +114,26 @@ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: str = "https://management.azure.com", + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: - self._config = MicrosoftSupportConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + _endpoint = "{endpoint}" + _cloud = cloud_setting or settings.current.azure_cloud # type: ignore + _endpoints = get_arm_endpoints(_cloud) + if not base_url: + base_url = _endpoints["resource_manager"] + credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) + self._config = SupportMgmtClientConfiguration( + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs + ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -111,25 +152,38 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) + self._serialize = Serializer() + self._deserialize = Deserializer() 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.problem_classifications = ProblemClassificationsOperations( + self.classify_services = ClassifyServicesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.support_tickets = SupportTicketsOperations(self._client, self._config, self._serialize, self._deserialize) - self.support_tickets_no_subscription = SupportTicketsNoSubscriptionOperations( + self.classify_services_no_subscription = ClassifyServicesNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.classify_problems = ClassifyProblemsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.classify_problems_no_subscription = ClassifyProblemsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.problem_classifications = ProblemClassificationsOperations( self._client, self._config, self._serialize, self._deserialize ) self.communications = CommunicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.support_tickets = SupportTicketsOperations(self._client, self._config, self._serialize, self._deserialize) self.communications_no_subscription = CommunicationsNoSubscriptionOperations( self._client, self._config, self._serialize, self._deserialize ) + self.support_tickets_no_subscription = SupportTicketsNoSubscriptionOperations( + self._client, self._config, self._serialize, self._deserialize + ) self.chat_transcripts = ChatTranscriptsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -145,7 +199,7 @@ def __init__( self._client, self._config, self._serialize, self._deserialize ) - def _send_request( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -153,7 +207,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -166,13 +220,17 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: await self._client.close() - async def __aenter__(self) -> "MicrosoftSupport": + async def __aenter__(self) -> Self: await self._client.__aenter__() return self diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_configuration.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_configuration.py index 7e2315ec2c70..844da2526fac 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 @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,27 +14,40 @@ from .._version import VERSION if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential -class MicrosoftSupportConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for MicrosoftSupport. +class SupportMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for SupportMgmtClient. Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is + None. + :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Known values are "2026-07-01" + and None. Default value is None. If not set, the operation's default API version will be used. + Note that overriding this default value may result in unsupported behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2026-07-01") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -43,6 +56,8 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.cloud_setting = cloud_setting 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)) diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_patch.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_patch.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/__init__.py index 7700443bd45e..0a91122099dc 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 @@ -2,36 +2,50 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._services_operations import ServicesOperations -from ._problem_classifications_operations import ProblemClassificationsOperations -from ._support_tickets_operations import SupportTicketsOperations -from ._support_tickets_no_subscription_operations import SupportTicketsNoSubscriptionOperations -from ._communications_operations import CommunicationsOperations -from ._communications_no_subscription_operations import CommunicationsNoSubscriptionOperations -from ._chat_transcripts_operations import ChatTranscriptsOperations -from ._chat_transcripts_no_subscription_operations import ChatTranscriptsNoSubscriptionOperations -from ._file_workspaces_operations import FileWorkspacesOperations -from ._file_workspaces_no_subscription_operations import FileWorkspacesNoSubscriptionOperations -from ._files_operations import FilesOperations -from ._files_no_subscription_operations import FilesNoSubscriptionOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import ServicesOperations # type: ignore +from ._operations import ClassifyServicesOperations # type: ignore +from ._operations import ClassifyServicesNoSubscriptionOperations # type: ignore +from ._operations import ClassifyProblemsOperations # type: ignore +from ._operations import ClassifyProblemsNoSubscriptionOperations # type: ignore +from ._operations import ProblemClassificationsOperations # type: ignore +from ._operations import CommunicationsOperations # type: ignore +from ._operations import SupportTicketsOperations # type: ignore +from ._operations import CommunicationsNoSubscriptionOperations # type: ignore +from ._operations import SupportTicketsNoSubscriptionOperations # type: ignore +from ._operations import ChatTranscriptsOperations # type: ignore +from ._operations import ChatTranscriptsNoSubscriptionOperations # type: ignore +from ._operations import FileWorkspacesOperations # type: ignore +from ._operations import FileWorkspacesNoSubscriptionOperations # type: ignore +from ._operations import FilesOperations # type: ignore +from ._operations import FilesNoSubscriptionOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "ServicesOperations", + "ClassifyServicesOperations", + "ClassifyServicesNoSubscriptionOperations", + "ClassifyProblemsOperations", + "ClassifyProblemsNoSubscriptionOperations", "ProblemClassificationsOperations", - "SupportTicketsOperations", - "SupportTicketsNoSubscriptionOperations", "CommunicationsOperations", + "SupportTicketsOperations", "CommunicationsNoSubscriptionOperations", + "SupportTicketsNoSubscriptionOperations", "ChatTranscriptsOperations", "ChatTranscriptsNoSubscriptionOperations", "FileWorkspacesOperations", @@ -39,5 +53,5 @@ "FilesOperations", "FilesNoSubscriptionOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_no_subscription_operations.py deleted file mode 100644 index 755d72d51c69..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_no_subscription_operations.py +++ /dev/null @@ -1,192 +0,0 @@ -# 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 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.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, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ChatTranscriptsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`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 - :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 - ) -> _models.ChatTranscriptDetails: - """Returns chatTranscript details for a no subscription support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param chat_transcript_name: ChatTranscript name. Required. - :type chat_transcript_name: str - :return: ChatTranscriptDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - chat_transcript_name=chat_transcript_name, - api_version=api_version, - 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("ChatTranscriptDetails", 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/_chat_transcripts_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_operations.py deleted file mode 100644 index 3edc30641c9b..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_chat_transcripts_operations.py +++ /dev/null @@ -1,194 +0,0 @@ -# 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 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.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_operations import build_get_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ChatTranscriptsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`chat_transcripts` 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 under subscription. - - :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, - subscription_id=self._config.subscription_id, - 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 - ) -> _models.ChatTranscriptDetails: - """Returns chatTranscript details for a support ticket under a subscription. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param chat_transcript_name: ChatTranscript name. Required. - :type chat_transcript_name: str - :return: ChatTranscriptDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - chat_transcript_name=chat_transcript_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("ChatTranscriptDetails", 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/_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_no_subscription_operations.py deleted file mode 100644 index 4cf8c6427c3b..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_no_subscription_operations.py +++ /dev/null @@ -1,535 +0,0 @@ -# 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, 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, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._communications_no_subscription_operations import ( - build_check_name_availability_request, - build_create_request, - build_get_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CommunicationsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`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") - - @overload - async def check_name_availability( - self, - support_ticket_name: str, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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 adding a new communication to the support ticket. - - :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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_request( - support_ticket_name=support_ticket_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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - 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 pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, support_ticket_name: str, communication_name: str, **kwargs: Any - ) -> _models.CommunicationDetails: - """Returns communication details for a support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :return: CommunicationDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CommunicationDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - api_version=api_version, - 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("CommunicationDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_communication_parameters, (IOBase, bytes)): - _content = create_communication_parameters - else: - _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - - _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, - 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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: _models.CommunicationDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :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 - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Is either a CommunicationDetails - 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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.CommunicationDetails] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - create_communication_parameters=create_communication_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_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[_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 deleted file mode 100644 index 3e7cb58c22f6..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_communications_operations.py +++ /dev/null @@ -1,535 +0,0 @@ -# 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, 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, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._communications_operations import ( - build_check_name_availability_request, - build_create_request, - build_get_request, - build_list_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class CommunicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`communications` 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 check_name_availability( - self, - support_ticket_name: str, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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 adding a new communication to the support ticket. - - :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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _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, - 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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - 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, - subscription_id=self._config.subscription_id, - 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 pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, support_ticket_name: str, communication_name: str, **kwargs: Any - ) -> _models.CommunicationDetails: - """Returns communication details for a support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :return: CommunicationDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CommunicationDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("CommunicationDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_communication_parameters, (IOBase, bytes)): - _content = create_communication_parameters - else: - _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - - _request = build_create_request( - support_ticket_name=support_ticket_name, - communication_name=communication_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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: _models.CommunicationDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :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 - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Is either a CommunicationDetails - 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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.CommunicationDetails] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - create_communication_parameters=create_communication_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_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[_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 deleted file mode 100644 index 783df934f0c6..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_no_subscription_operations.py +++ /dev/null @@ -1,155 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -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._file_workspaces_no_subscription_operations import build_create_request, build_get_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FileWorkspacesNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`file_workspaces_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_async - async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Gets details for a specific file workspace. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - api_version=api_version, - 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("FileWorkspaceDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Creates a new file workspace. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - api_version=api_version, - 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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileWorkspaceDetails", 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/_file_workspaces_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_operations.py deleted file mode 100644 index 4294736acf51..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_file_workspaces_operations.py +++ /dev/null @@ -1,157 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -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._file_workspaces_operations import build_create_request, build_get_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FileWorkspacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`file_workspaces` 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_async - async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Gets details for a specific file workspace in an Azure subscription. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("FileWorkspaceDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Creates a new file workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileWorkspaceDetails", 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/_files_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_no_subscription_operations.py deleted file mode 100644 index 316fbe98d52f..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_no_subscription_operations.py +++ /dev/null @@ -1,442 +0,0 @@ -# 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, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._files_no_subscription_operations import ( - build_create_request, - build_get_request, - build_list_request, - build_upload_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FilesNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`files_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, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_models.FileDetails"]: - """Lists all the Files information under a workspace for an Azure subscription. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :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: - """ - _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.FilesListResult] = 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( - file_workspace_name=file_workspace_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("FilesListResult", 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, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: - """Returns details of a specific file in a work space. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - file_name=file_name, - api_version=api_version, - 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("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: _models.FileDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :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 - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: Union[_models.FileDetails, IO[bytes]], - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace. - - :param file_workspace_name: File workspace name. Required. - :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[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: - """ - 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.FileDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_file_parameters, (IOBase, bytes)): - _content = create_file_parameters - else: - _json = self._serialize.body(create_file_parameters, "FileDetails") - - _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, - 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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: _models.UploadFile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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[bytes]], **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :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[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: - """ - 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[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(upload_file, (IOBase, bytes)): - _content = upload_file - else: - _json = self._serialize.body(upload_file, "UploadFile") - - _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, - 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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # 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 deleted file mode 100644 index a074dec56bdb..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_files_operations.py +++ /dev/null @@ -1,446 +0,0 @@ -# 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, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._files_operations import ( - build_create_request, - build_get_request, - build_list_request, - build_upload_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`files` 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, file_workspace_name: str, **kwargs: Any) -> AsyncIterable["_models.FileDetails"]: - """Lists all the Files information under a workspace for an Azure subscription. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :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: - """ - _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.FilesListResult] = 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( - file_workspace_name=file_workspace_name, - subscription_id=self._config.subscription_id, - 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("FilesListResult", 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, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: - """Returns details of a specific file in a work space. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - file_name=file_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: _models.FileDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :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 - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: Union[_models.FileDetails, IO[bytes]], - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :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[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: - """ - 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.FileDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_file_parameters, (IOBase, bytes)): - _content = create_file_parameters - else: - _json = self._serialize.body(create_file_parameters, "FileDetails") - - _request = build_create_request( - file_workspace_name=file_workspace_name, - file_name=file_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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: _models.UploadFile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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[bytes]], **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :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[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: - """ - 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[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(upload_file, (IOBase, bytes)): - _content = upload_file - else: - _json = self._serialize.body(upload_file, "UploadFile") - - _request = build_upload_request( - file_workspace_name=file_workspace_name, - file_name=file_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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_operations.py index f35fe0803df8..843da5ae75a1 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,14 +1,18 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, @@ -16,21 +20,74 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._operations import build_list_request +from ... import models as _models, types as _types +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ..._validation import api_version_validation +from ...operations._operations import ( + build_chat_transcripts_get_request, + build_chat_transcripts_list_request, + build_chat_transcripts_no_subscription_get_request, + build_chat_transcripts_no_subscription_list_request, + build_classify_problems_classify_problems_request, + build_classify_problems_no_subscription_classify_problems_request, + build_classify_services_classify_services_request, + build_classify_services_no_subscription_classify_services_request, + build_communications_check_name_availability_request, + build_communications_create_request, + build_communications_get_request, + build_communications_list_request, + build_communications_no_subscription_check_name_availability_request, + build_communications_no_subscription_create_request, + build_communications_no_subscription_get_request, + build_communications_no_subscription_list_request, + build_file_workspaces_create_request, + build_file_workspaces_get_request, + build_file_workspaces_no_subscription_create_request, + build_file_workspaces_no_subscription_get_request, + build_files_create_request, + build_files_get_request, + build_files_list_request, + build_files_no_subscription_create_request, + build_files_no_subscription_get_request, + build_files_no_subscription_list_request, + build_files_no_subscription_upload_request, + build_files_upload_request, + build_operations_list_request, + build_problem_classifications_get_request, + build_problem_classifications_list_request, + build_services_get_request, + build_services_list_request, + build_support_tickets_check_name_availability_request, + build_support_tickets_create_request, + build_support_tickets_get_request, + build_support_tickets_list_request, + build_support_tickets_look_up_resource_id_request, + build_support_tickets_no_subscription_check_name_availability_request, + build_support_tickets_no_subscription_create_request, + build_support_tickets_no_subscription_get_request, + build_support_tickets_no_subscription_list_request, + build_support_tickets_no_subscription_update_request, + build_support_tickets_update_request, +) +from .._configuration import SupportMgmtClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +List = list class Operations: @@ -39,34 +96,212 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s :attr:`operations` 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") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """This lists all the available Microsoft Support REST API operations. + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Operation"]: + """List the operations for the provider. - :return: An iterator like instance of either Operation or the result of cls(response) + :return: An iterator like instance of Operation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, 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. + :type service_name: str + :return: Service. The Service is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.Service + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Service] = kwargs.pop("cls", None) + + _request = build_services_get_request( + service_name=service_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Service, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Service"]: + """Lists all the Azure services available for support ticket creation. For **Technical** issues, + select the Service Id that maps to the Azure service/product as displayed in the **Services** + drop-down list on the Azure portal's `New support request + `_ page. + Always use the service and its corresponding problem classification(s) obtained + programmatically for support ticket creation. This practice ensures that you always have the + most recent set of service and problem classification Ids. + + :return: An iterator like instance of Service + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.Service] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Service]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -77,13 +312,17 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_services_list_request( + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -96,19 +335,29 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationsListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Service], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -121,9 +370,5496 @@ async def get_next(next_link=None): 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) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + +class ClassifyServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`classify_services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def classify_services( + self, + service_classification_request: _types.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.types.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. The ServiceClassificationOutput is compatible with + MutableMapping + :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. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "subscription_id", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + async def classify_services( + self, + service_classification_request: Union[ + _models.ServiceClassificationRequest, _types.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 ~azure.mgmt.support.types.ServiceClassificationRequest or IO[bytes] + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _content = json.dumps(service_classification_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_services_classify_services_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServiceClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ClassifyServicesNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`classify_services_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def classify_services( + self, + service_classification_request: _types.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.types.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. The ServiceClassificationOutput is compatible with + MutableMapping + :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. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + async def classify_services( + self, + service_classification_request: Union[ + _models.ServiceClassificationRequest, _types.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 ~azure.mgmt.support.types.ServiceClassificationRequest or IO[bytes] + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _content = json.dumps(service_classification_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_services_no_subscription_classify_services_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServiceClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ClassifyProblemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`classify_problems` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :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: _types.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.types.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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={ + "2026-06-01": ["api_version", "subscription_id", "problem_service_name", "content_type", "accept"] + }, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, + _types.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 + ~azure.mgmt.support.types.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _content = json.dumps(problem_classifications_classification_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_problems_classify_problems_request( + problem_service_name=problem_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProblemClassificationsClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ClassifyProblemsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`classify_problems_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :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: _types.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.types.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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "problem_service_name", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + async def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, + _types.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 + ~azure.mgmt.support.types.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _content = json.dumps(problem_classifications_classification_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_problems_no_subscription_classify_problems_request( + problem_service_name=problem_service_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProblemClassificationsClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProblemClassificationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`problem_classifications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, 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. Required. + :type service_name: str + :param problem_classification_name: Name of problem classification. Required. + :type problem_classification_name: str + :return: ProblemClassification. The ProblemClassification is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassification + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ProblemClassification] = kwargs.pop("cls", None) + + _request = build_problem_classifications_get_request( + service_name=service_name, + problem_classification_name=problem_classification_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProblemClassification, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, service_name: str, **kwargs: Any) -> AsyncItemPaged["_models.ProblemClassification"]: + """Lists all the problem classifications (categories) available for a specific Azure service. + Always use the service and problem classifications obtained programmatically. This practice + ensures that you always have the most recent set of service and problem classification Ids. + + :param service_name: Name of the Azure service. Required. + :type service_name: str + :return: An iterator like instance of ProblemClassification + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.ProblemClassification] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProblemClassification]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_problem_classifications_list_request( + service_name=service_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ProblemClassification], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CommunicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`communications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, support_ticket_name: str, communication_name: str, **kwargs: Any + ) -> _models.CommunicationDetails: + """Returns communication details for a support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :return: CommunicationDetails. The CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.CommunicationDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + + _request = build_communications_get_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_communication_parameters, (IOBase, bytes)): + _content = create_communication_parameters + else: + _content = json.dumps(create_communication_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_create_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _models.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _types.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.types.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :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 + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Is either a CommunicationDetails + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + ~azure.mgmt.support.types.CommunicationDetails or IO[bytes] + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + create_communication_parameters=create_communication_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_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[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, support_ticket_name: str, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.CommunicationDetails"]: + """Lists all communications (attachments not included) for a support ticket.

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.

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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :keyword top: The number of values to return in the collection. Default is 10 and max is 10. + Default value is None. + :paramtype top: int + :keyword 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. + :paramtype filter: str + :return: An iterator like instance of CommunicationDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunicationDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_communications_list_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommunicationDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_check_name_availability_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SupportTicketsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`support_tickets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: + """Get ticket details for an Azure subscription. 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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + _request = build_support_tickets_get_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_support_ticket_parameters, (IOBase, bytes)): + _content = create_support_ticket_parameters + else: + _content = json.dumps(create_support_ticket_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_create_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _models.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _types.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.types.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :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 + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Is either a + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + ~azure.mgmt.support.types.SupportTicketDetails or IO[bytes] + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + support_ticket_name=support_ticket_name, + create_support_ticket_parameters=create_support_ticket_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_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[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: _models.UpdateSupportTicket, + *, + content_type: str = "application/json", + **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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: _types.UpdateSupportTicket, + *, + content_type: str = "application/json", + **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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.types.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :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 + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, _types.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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or + ~azure.mgmt.support.types.UpdateSupportTicket or IO[bytes] + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(update_support_ticket, (IOBase, bytes)): + _content = update_support_ticket + else: + _content = json.dumps(update_support_ticket, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_update_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.SupportTicketDetails"]: + """Lists all the support tickets for an Azure subscription. You can also filter the support + tickets by *Status*, *CreatedDate*, *ServiceId*, and *ProblemClassificationId* using the + $filter parameter. Output will be a paged result with *nextLink*, using which you can retrieve + the next set of support tickets.

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. + + :keyword top: The number of values to return in the collection. Default is 25 and max is 100. + Default value is None. + :paramtype top: int + :keyword filter: The filter to apply on the operation. We support 'odata v4.0' filter + semantics. `Learn more `_. + *Status*, *ServiceId*, and *ProblemClassificationId* filters can only be used with Equals + ('eq') operator. For *CreatedDate* filter, the supported operators are Greater Than ('gt') and + Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. + Default value is None. + :paramtype filter: str + :return: An iterator like instance of SupportTicketDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_support_tickets_list_request( + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SupportTicketDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def look_up_resource_id( + 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. + + :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. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def look_up_resource_id( + self, + look_up_resource_id_request: _types.LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """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.types.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. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def look_up_resource_id( + 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. + + :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. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + async def look_up_resource_id( + self, + look_up_resource_id_request: Union[_models.LookUpResourceIdRequest, _types.LookUpResourceIdRequest, IO[bytes]], + **kwargs: Any + ) -> _models.LookUpResourceIdResponse: + """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 + ~azure.mgmt.support.types.LookUpResourceIdRequest or IO[bytes] + :return: LookUpResourceIdResponse. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(look_up_resource_id_request, (IOBase, bytes)): + _content = look_up_resource_id_request + else: + _content = json.dumps(look_up_resource_id_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_look_up_resource_id_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LookUpResourceIdResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def check_name_availability( + self, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + 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: The request body. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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: The request body. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CommunicationsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`communications_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, support_ticket_name: str, communication_name: str, **kwargs: Any + ) -> _models.CommunicationDetails: + """Returns communication details for a support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :return: CommunicationDetails. The CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.CommunicationDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + + _request = build_communications_no_subscription_get_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_communication_parameters, (IOBase, bytes)): + _content = create_communication_parameters + else: + _content = json.dumps(create_communication_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_no_subscription_create_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _models.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _types.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.types.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :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 + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Is either a CommunicationDetails + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + ~azure.mgmt.support.types.CommunicationDetails or IO[bytes] + :return: An instance of AsyncLROPoller that returns CommunicationDetails. The + CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + create_communication_parameters=create_communication_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_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[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, support_ticket_name: str, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.CommunicationDetails"]: + """Lists all communications (attachments not included) for a support ticket.

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.

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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :keyword top: The number of values to return in the collection. Default is 10 and max is 10. + Default value is None. + :paramtype top: int + :keyword 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. + :paramtype filter: str + :return: An iterator like instance of CommunicationDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunicationDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_communications_no_subscription_list_request( + support_ticket_name=support_ticket_name, + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommunicationDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + support_ticket_name: str, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_no_subscription_check_name_availability_request( + support_ticket_name=support_ticket_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SupportTicketsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`support_tickets_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: + """Gets details for a specific support ticket. 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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + _request = build_support_tickets_no_subscription_get_request( + support_ticket_name=support_ticket_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_support_ticket_parameters, (IOBase, bytes)): + _content = create_support_ticket_parameters + else: + _content = json.dumps(create_support_ticket_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_no_subscription_create_request( + support_ticket_name=support_ticket_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _models.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _types.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.types.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :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 + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Is either a + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + ~azure.mgmt.support.types.SupportTicketDetails or IO[bytes] + :return: An instance of AsyncLROPoller that returns SupportTicketDetails. The + SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + support_ticket_name=support_ticket_name, + create_support_ticket_parameters=create_support_ticket_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_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[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: _models.UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SupportTicketDetails: + """This API allows you to update the severity level, ticket status, and your contact information + in the support ticket.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: _types.UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SupportTicketDetails: + """This API allows you to update the severity level, ticket status, and your contact information + in the support ticket.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.types.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SupportTicketDetails: + """This API allows you to update the severity level, ticket status, and your contact information + in the support ticket.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :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 + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, _types.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.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or + ~azure.mgmt.support.types.UpdateSupportTicket or IO[bytes] + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(update_support_ticket, (IOBase, bytes)): + _content = update_support_ticket + else: + _content = json.dumps(update_support_ticket, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_no_subscription_update_request( + support_ticket_name=support_ticket_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.SupportTicketDetails"]: + """Lists all the support tickets.

You can also filter the support tickets by + Status, CreatedDate, , ServiceId, and ProblemClassificationId using + the $filter parameter. Output will be a paged result with nextLink, using which you can + retrieve the next set of support tickets.

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. + + :keyword top: The number of values to return in the collection. Default is 25 and max is 100. + Default value is None. + :paramtype top: int + :keyword filter: The filter to apply on the operation. We support 'odata v4.0' filter + semantics.
Learn more +
Status , ServiceId, and ProblemClassificationId filters can only be + used with 'eq' operator. For CreatedDate filter, the supported operators are 'gt' and + 'ge'. When using both filters, combine them using the logical 'AND'. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SupportTicketDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_support_tickets_no_subscription_list_request( + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SupportTicketDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def check_name_availability( + self, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + 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: The request body. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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: The request body. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_no_subscription_check_name_availability_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ChatTranscriptsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`chat_transcripts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any + ) -> _models.ChatTranscriptDetails: + """Returns chatTranscript details for a support ticket under a subscription. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param chat_transcript_name: The name of the ChatTranscriptDetails. Required. + :type chat_transcript_name: str + :return: ChatTranscriptDetails. The ChatTranscriptDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) + + _request = build_chat_transcripts_get_request( + support_ticket_name=support_ticket_name, + chat_transcript_name=chat_transcript_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ChatTranscriptDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncItemPaged["_models.ChatTranscriptDetails"]: + """Lists all chat transcripts for a support ticket under subscription. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: An iterator like instance of ChatTranscriptDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ChatTranscriptDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_chat_transcripts_list_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ChatTranscriptDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ChatTranscriptsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`chat_transcripts_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any + ) -> _models.ChatTranscriptDetails: + """Returns chatTranscript details for a no subscription support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param chat_transcript_name: The name of the ChatTranscriptDetails. Required. + :type chat_transcript_name: str + :return: ChatTranscriptDetails. The ChatTranscriptDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) + + _request = build_chat_transcripts_no_subscription_get_request( + support_ticket_name=support_ticket_name, + chat_transcript_name=chat_transcript_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ChatTranscriptDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, support_ticket_name: str, **kwargs: Any) -> AsyncItemPaged["_models.ChatTranscriptDetails"]: + """Lists all chat transcripts for a support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: An iterator like instance of ChatTranscriptDetails + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ChatTranscriptDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_chat_transcripts_no_subscription_list_request( + support_ticket_name=support_ticket_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ChatTranscriptDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class FileWorkspacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`file_workspaces` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Gets details for a specific file workspace in an Azure subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_get_request( + file_workspace_name=file_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Creates a new file workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_create_request( + file_workspace_name=file_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FileWorkspacesNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`file_workspaces_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Gets details for a specific file workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_no_subscription_get_request( + file_workspace_name=file_workspace_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Creates a new file workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_no_subscription_create_request( + file_workspace_name=file_workspace_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`files` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: + """Returns details of a specific file in a work space. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + _request = build_files_get_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _models.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _types.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.types.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :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 + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: Union[_models.FileDetails, _types.FileDetails, IO[bytes]], + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.FileDetails or IO[bytes] + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_file_parameters, (IOBase, bytes)): + _content = create_file_parameters + else: + _content = json.dumps(create_file_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_create_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncItemPaged["_models.FileDetails"]: + """Lists all the Files information under a workspace for an Azure subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: An iterator like instance of FileDetails + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.FileDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FileDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_files_list_request( + file_workspace_name=file_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.FileDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _models.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _types.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.types.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :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 + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: Union[_models.UploadFile, _types.UploadFile, IO[bytes]], + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.UploadFile or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(upload_file, (IOBase, bytes)): + _content = upload_file + else: + _content = json.dumps(upload_file, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_upload_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class FilesNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.aio.SupportMgmtClient`'s + :attr:`files_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: + """Returns details of a specific file in a work space. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + _request = build_files_no_subscription_get_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _models.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _types.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.types.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :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 + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: Union[_models.FileDetails, _types.FileDetails, IO[bytes]], + **kwargs: Any + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.FileDetails or IO[bytes] + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_file_parameters, (IOBase, bytes)): + _content = create_file_parameters + else: + _content = json.dumps(create_file_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_no_subscription_create_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, file_workspace_name: str, **kwargs: Any) -> AsyncItemPaged["_models.FileDetails"]: + """Lists all the Files information under a workspace for an Azure subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: An iterator like instance of FileDetails + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.FileDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FileDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_files_no_subscription_list_request( + file_workspace_name=file_workspace_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.FileDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _models.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _types.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.types.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :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 + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: Union[_models.UploadFile, _types.UploadFile, IO[bytes]], + **kwargs: Any + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.UploadFile or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(upload_file, (IOBase, bytes)): + _content = upload_file + else: + _content = json.dumps(upload_file, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_no_subscription_upload_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_patch.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_patch.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): 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 deleted file mode 100644 index b950a8ec3f27..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_problem_classifications_operations.py +++ /dev/null @@ -1,195 +0,0 @@ -# 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 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.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._problem_classifications_operations import build_get_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ProblemClassificationsOperations: - """ - .. 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` 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, service_name: str, **kwargs: Any) -> AsyncIterable["_models.ProblemClassification"]: - """Lists all the problem classifications (categories) available for a specific Azure service. - Always use the service and problem classifications obtained programmatically. This practice - ensures that you always have the most recent set of service and problem classification Ids. - - :param service_name: Name of the Azure service for which the problem classifications need to be - retrieved. Required. - :type service_name: str - :return: An iterator like instance of either ProblemClassification or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.ProblemClassification] - :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.ProblemClassificationsListResult] = 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( - service_name=service_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("ProblemClassificationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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, 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. - :type service_name: str - :param problem_classification_name: Name of problem classification. Required. - :type problem_classification_name: str - :return: ProblemClassification or the result of cls(response) - :rtype: ~azure.mgmt.support.models.ProblemClassification - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - service_name=service_name, - problem_classification_name=problem_classification_name, - api_version=api_version, - 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("ProblemClassification", 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 deleted file mode 100644 index 9a2d4cbbc3d6..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_services_operations.py +++ /dev/null @@ -1,188 +0,0 @@ -# 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 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.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._services_operations import build_get_request, build_list_request - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`services` 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, **kwargs: Any) -> AsyncIterable["_models.Service"]: - """Lists all the Azure services available for support ticket creation. For **Technical** issues, - select the Service Id that maps to the Azure service/product as displayed in the **Services** - drop-down list on the Azure portal's `New support request - `_ page. - Always use the service and its corresponding problem classification(s) obtained - programmatically for support ticket creation. This practice ensures that you always have the - most recent set of service and problem classification Ids. - - :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: - """ - _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.ServicesListResult] = 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( - 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("ServicesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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, 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. - :type service_name: str - :return: Service or the result of cls(response) - :rtype: ~azure.mgmt.support.models.Service - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - service_name=service_name, - api_version=api_version, - 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("Service", 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/_support_tickets_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_no_subscription_operations.py deleted file mode 100644 index 62a9209d7068..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_no_subscription_operations.py +++ /dev/null @@ -1,667 +0,0 @@ -# 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, 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, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._support_tickets_no_subscription_operations import ( - build_check_name_availability_request, - build_create_request, - build_get_request, - build_list_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SupportTicketsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`support_tickets_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 check_name_availability( - self, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - 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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - 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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.SupportTicketDetails"]: - """Lists all the support tickets. :code:`
`:code:`
`You can also filter the support - tickets by :code:`Status`, :code:`CreatedDate`, , :code:`ServiceId`, and - :code:`ProblemClassificationId` using the $filter parameter. Output will be a paged - result with :code:`nextLink`, using which you can retrieve the next set of support - tickets. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. - - :param top: The number of values to return in the collection. Default is 25 and max is 100. - Default value is None. - :type top: int - :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. - :code:`Learn more` - :code:`
`:code:`Status` , :code:`ServiceId`, and - :code:`ProblemClassificationId` filters can only be used with 'eq' operator. For - :code:`CreatedDate` filter, the supported operators are 'gt' and 'ge'. When using both - filters, combine them using the logical 'AND'. Default value is None. - :type filter: str - :return: An iterator like instance of either SupportTicketDetails or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.SupportTicketDetails] - :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.SupportTicketsListResult] = 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( - 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("SupportTicketsListResult", 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, **kwargs: Any) -> _models.SupportTicketDetails: - """Gets details for a specific support ticket. 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 - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - 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) - - _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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - support_ticket_name: str, - update_support_ticket: _models.UpdateSupportTicket, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - support_ticket_name: str, - update_support_ticket: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - 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 - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - 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: - """ - 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.SupportTicketDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_support_ticket, (IOBase, bytes)): - _content = update_support_ticket - else: - _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - - _request = build_update_request( - support_ticket_name=support_ticket_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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_support_ticket_parameters, (IOBase, bytes)): - _content = create_support_ticket_parameters - else: - _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - - _request = build_create_request( - support_ticket_name=support_ticket_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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: _models.SupportTicketDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. - - :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: ~azure.mgmt.support.models.SupportTicketDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - support_ticket_name: str, - 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 - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. - - :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[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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.SupportTicketDetails] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - support_ticket_name=support_ticket_name, - create_support_ticket_parameters=create_support_ticket_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_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[_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 deleted file mode 100644 index 2ac02397efcd..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/aio/operations/_support_tickets_operations.py +++ /dev/null @@ -1,687 +0,0 @@ -# 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, 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, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import HttpRequest -from azure.core.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 azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._vendor import _convert_request -from ...operations._support_tickets_operations import ( - build_check_name_availability_request, - build_create_request, - build_get_request, - build_list_request, - build_update_request, -) - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SupportTicketsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.aio.MicrosoftSupport`'s - :attr:`support_tickets` 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 check_name_availability( - self, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - 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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - 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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.SupportTicketDetails"]: - """Lists all the support tickets for an Azure subscription. You can also filter the support - tickets by *Status*\ , *CreatedDate*\ , *ServiceId*\ , and *ProblemClassificationId* using the - $filter parameter. Output will be a paged result with *nextLink*\ , using which you can - retrieve the next set of support tickets. :code:`
`:code:`
`Support ticket data is - available for 18 months after ticket creation. If a ticket was created more than 18 months ago, - a request for data might cause an error. - - :param top: The number of values to return in the collection. Default is 25 and max is 100. - Default value is None. - :type top: int - :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. - `Learn more `_. *Status*\ , - *ServiceId*\ , and *ProblemClassificationId* filters can only be used with Equals ('eq') - operator. For *CreatedDate* filter, the supported operators are Greater Than ('gt') and Greater - Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. Default - value is None. - :type filter: str - :return: An iterator like instance of either SupportTicketDetails or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.support.models.SupportTicketDetails] - :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.SupportTicketsListResult] = 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( - subscription_id=self._config.subscription_id, - 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("SupportTicketsListResult", 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, **kwargs: Any) -> _models.SupportTicketDetails: - """Get ticket details for an Azure subscription. 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 - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - support_ticket_name: str, - update_support_ticket: _models.UpdateSupportTicket, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - support_ticket_name: str, - update_support_ticket: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - 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 - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - 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: - """ - 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.SupportTicketDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_support_ticket, (IOBase, bytes)): - _content = update_support_ticket - else: - _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - - _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, - 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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_support_ticket_parameters, (IOBase, bytes)): - _content = create_support_ticket_parameters - else: - _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - - _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, - 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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: _models.SupportTicketDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, - and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation - `_. - The primary token will be from the tenant for whom a support ticket is being raised against the - subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be - from the Cloud solution provider (CSP) partner tenant. - - :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: ~azure.mgmt.support.models.SupportTicketDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, - and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation - `_. - The primary token will be from the tenant for whom a support ticket is being raised against the - subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be - from the Cloud solution provider (CSP) partner tenant. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - support_ticket_name: str, - 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, - and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation - `_. - The primary token will be from the tenant for whom a support ticket is being raised against the - subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be - from the Cloud solution provider (CSP) partner tenant. - - :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[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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.SupportTicketDetails] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - support_ticket_name=support_ticket_name, - create_support_ticket_parameters=create_support_ticket_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_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[_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 57c65d599461..d35cd899019a 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 @@ -2,82 +2,114 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._models_py3 import ChatTranscriptDetails -from ._models_py3 import ChatTranscriptsListResult -from ._models_py3 import CheckNameAvailabilityInput -from ._models_py3 import CheckNameAvailabilityOutput -from ._models_py3 import CommunicationDetails -from ._models_py3 import CommunicationsListResult -from ._models_py3 import ContactProfile -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import FileDetails -from ._models_py3 import FileWorkspaceDetails -from ._models_py3 import FilesListResult -from ._models_py3 import MessageProperties -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationsListResult -from ._models_py3 import ProblemClassification -from ._models_py3 import ProblemClassificationsListResult -from ._models_py3 import ProxyResource -from ._models_py3 import QuotaChangeRequest -from ._models_py3 import QuotaTicketDetails -from ._models_py3 import Resource -from ._models_py3 import SecondaryConsent -from ._models_py3 import SecondaryConsentEnabled -from ._models_py3 import Service -from ._models_py3 import ServiceLevelAgreement -from ._models_py3 import ServicesListResult -from ._models_py3 import SupportEngineer -from ._models_py3 import SupportTicketDetails -from ._models_py3 import SupportTicketsListResult -from ._models_py3 import SystemData -from ._models_py3 import TechnicalTicketDetails -from ._models_py3 import UpdateContactProfile -from ._models_py3 import UpdateSupportTicket -from ._models_py3 import UploadFile +from typing import TYPE_CHECKING -from ._microsoft_support_enums import CommunicationDirection -from ._microsoft_support_enums import CommunicationType -from ._microsoft_support_enums import Consent -from ._microsoft_support_enums import CreatedByType -from ._microsoft_support_enums import IsTemporaryTicket -from ._microsoft_support_enums import PreferredContactMethod -from ._microsoft_support_enums import SeverityLevel -from ._microsoft_support_enums import Status -from ._microsoft_support_enums import TranscriptContentType -from ._microsoft_support_enums import Type -from ._microsoft_support_enums import UserConsent +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + + +from ._models import ( # type: ignore + ChatTranscriptDetails, + ChatTranscriptDetailsProperties, + CheckNameAvailabilityInput, + CheckNameAvailabilityOutput, + ClassificationService, + CommunicationDetails, + CommunicationDetailsProperties, + ContactProfile, + DirectConnectEscalation, + ErrorAdditionalInfo, + ErrorDetail, + ErrorResponse, + FileDetails, + FileDetailsProperties, + FileWorkspaceDetails, + FileWorkspaceDetailsProperties, + LookUpResourceIdRequest, + LookUpResourceIdResponse, + MessageProperties, + Operation, + OperationDisplay, + ProblemClassification, + ProblemClassificationProperties, + ProblemClassificationsClassificationInput, + ProblemClassificationsClassificationOutput, + ProblemClassificationsClassificationResult, + ProxyResource, + QuotaChangeRequest, + QuotaTicketDetails, + Resource, + SecondaryConsent, + SecondaryConsentEnabled, + Service, + ServiceClassificationAnswer, + ServiceClassificationOutput, + ServiceClassificationRequest, + ServiceLevelAgreement, + ServiceProperties, + SupportEngineer, + SupportTicketDetails, + SupportTicketDetailsProperties, + SystemData, + TechnicalTicketDetails, + UpdateContactProfile, + UpdateSupportTicket, + UploadFile, +) + +from ._enums import ( # type: ignore + ActionType, + ChatConversationStatus, + CommunicationDirection, + CommunicationType, + Consent, + CreatedByType, + EscalationStatus, + IsTemporaryTicket, + Origin, + PreferredContactMethod, + SeverityLevel, + Status, + SupportChannel, + Type, + UserConsent, +) from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "ChatTranscriptDetails", - "ChatTranscriptsListResult", + "ChatTranscriptDetailsProperties", "CheckNameAvailabilityInput", "CheckNameAvailabilityOutput", + "ClassificationService", "CommunicationDetails", - "CommunicationsListResult", + "CommunicationDetailsProperties", "ContactProfile", + "DirectConnectEscalation", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", "FileDetails", + "FileDetailsProperties", "FileWorkspaceDetails", - "FilesListResult", + "FileWorkspaceDetailsProperties", + "LookUpResourceIdRequest", + "LookUpResourceIdResponse", "MessageProperties", "Operation", "OperationDisplay", - "OperationsListResult", "ProblemClassification", - "ProblemClassificationsListResult", + "ProblemClassificationProperties", + "ProblemClassificationsClassificationInput", + "ProblemClassificationsClassificationOutput", + "ProblemClassificationsClassificationResult", "ProxyResource", "QuotaChangeRequest", "QuotaTicketDetails", @@ -85,27 +117,34 @@ "SecondaryConsent", "SecondaryConsentEnabled", "Service", + "ServiceClassificationAnswer", + "ServiceClassificationOutput", + "ServiceClassificationRequest", "ServiceLevelAgreement", - "ServicesListResult", + "ServiceProperties", "SupportEngineer", "SupportTicketDetails", - "SupportTicketsListResult", + "SupportTicketDetailsProperties", "SystemData", "TechnicalTicketDetails", "UpdateContactProfile", "UpdateSupportTicket", "UploadFile", + "ActionType", + "ChatConversationStatus", "CommunicationDirection", "CommunicationType", "Consent", "CreatedByType", + "EscalationStatus", "IsTemporaryTicket", + "Origin", "PreferredContactMethod", "SeverityLevel", "Status", - "TranscriptContentType", + "SupportChannel", "Type", "UserConsent", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_enums.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_enums.py new file mode 100644 index 000000000000..c93abf4c1dc1 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_enums.py @@ -0,0 +1,169 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ + + INTERNAL = "Internal" + """Actions are for internal-only APIs.""" + + +class ChatConversationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of the chat conversation associated with the support ticket.""" + + ACTIVE = "Active" + """Chat conversation is currently active.""" + CLOSED = "Closed" + """Chat conversation has been closed.""" + + +class CommunicationDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Direction of communication.""" + + INBOUND = "inbound" + """INBOUND.""" + OUTBOUND = "outbound" + """OUTBOUND.""" + + +class CommunicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Communication type.""" + + WEB = "web" + """WEB.""" + PHONE = "phone" + """PHONE.""" + + +class Consent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Advanced diagnostic consent to be updated on the support ticket.""" + + YES = "Yes" + """YES.""" + NO = "No" + """NO.""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" + + +class EscalationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status of Direct Connect Escalation.""" + + ESCALATION_AVAILABLE = "EscalationAvailable" + """Escalation is available and uninitiated.""" + ESCALATION_INITIATED = "EscalationInitiated" + """Escalation is unavailable and has been initiated.""" + ESCALATION_PROCESSED = "EscalationProcessed" + """Escalation is unavailable and has finished processing after being initiated.""" + ESCALATION_UNSUPPORTED = "EscalationUnsupported" + """Escalation is unavailable and cannot be initiated due to direct escalation being unsupported on + this product or topic.""" + ESCALATION_UNAVAILABLE = "EscalationUnavailable" + """Escalation is unavailable and cannot be initiated due to customer not being enrolled to direct + escalation.""" + + +class IsTemporaryTicket(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """This property indicates if support ticket is a temporary ticket.""" + + YES = "Yes" + """YES.""" + NO = "No" + """NO.""" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + """Indicates the operation is initiated by a user.""" + SYSTEM = "system" + """Indicates the operation is initiated by a system.""" + USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + +class PreferredContactMethod(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Preferred contact method.""" + + EMAIL = "email" + """EMAIL.""" + PHONE = "phone" + """PHONE.""" + + +class SeverityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """A value that indicates the urgency of the case, which in turn determines the response time + according to the service level agreement of the technical support plan you have with Azure. + Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' level in the + Azure portal is reserved only for our Premium customers. + """ + + MINIMAL = "minimal" + """MINIMAL.""" + MODERATE = "moderate" + """MODERATE.""" + CRITICAL = "critical" + """CRITICAL.""" + HIGHESTCRITICALIMPACT = "highestcriticalimpact" + """HIGHESTCRITICALIMPACT.""" + + +class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Status to be updated on the ticket.""" + + OPEN = "open" + """OPEN.""" + CLOSED = "closed" + """CLOSED.""" + + +class SupportChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Support channel type for the support ticket.""" + + CHAT = "Chat" + """Chat support channel.""" + WEB = "Web" + """Web support channel.""" + + +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of resource.""" + + MICROSOFT_SUPPORT_SUPPORT_TICKETS = "Microsoft.Support/supportTickets" + """MICROSOFT_SUPPORT_SUPPORT_TICKETS.""" + MICROSOFT_SUPPORT_COMMUNICATIONS = "Microsoft.Support/communications" + """MICROSOFT_SUPPORT_COMMUNICATIONS.""" + + +class UserConsent(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """User consent value provided.""" + + YES = "Yes" + """YES.""" + NO = "No" + """NO.""" 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 deleted file mode 100644 index f545cc2f04df..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_microsoft_support_enums.py +++ /dev/null @@ -1,92 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class CommunicationDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Direction of communication.""" - - INBOUND = "inbound" - OUTBOUND = "outbound" - - -class CommunicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Communication type.""" - - WEB = "web" - PHONE = "phone" - - -class Consent(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Advanced diagnostic consent to be updated on the support ticket.""" - - YES = "Yes" - NO = "No" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - 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.""" - - EMAIL = "email" - PHONE = "phone" - - -class SeverityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """A value that indicates the urgency of the case, which in turn determines the response time - according to the service level agreement of the technical support plan you have with Azure. - Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' level in the - Azure portal is reserved only for our Premium customers. - """ - - MINIMAL = "minimal" - MODERATE = "moderate" - CRITICAL = "critical" - HIGHESTCRITICALIMPACT = "highestcriticalimpact" - - -class Status(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Status to be updated on the ticket.""" - - OPEN = "open" - CLOSED = "closed" - - -class TranscriptContentType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Content type.""" - - -class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of resource.""" - - MICROSOFT_SUPPORT_SUPPORT_TICKETS = "Microsoft.Support/supportTickets" - MICROSOFT_SUPPORT_COMMUNICATIONS = "Microsoft.Support/communications" - - -class UserConsent(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """User consent value provided.""" - - YES = "Yes" - NO = "No" diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models.py new file mode 100644 index 000000000000..eed9edb0044b --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models.py @@ -0,0 +1,2222 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + """ + + +class ChatTranscriptDetails(ProxyResource): + """Object that represents a Chat Transcript resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + :ivar properties: Properties of the resource. + :vartype properties: ~azure.mgmt.support.models.ChatTranscriptDetailsProperties + """ + + properties: Optional["_models.ChatTranscriptDetailsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the resource.""" + + __flattened_items = ["messages", "start_time"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ChatTranscriptDetailsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ChatTranscriptDetailsProperties(_Model): + """Describes the properties of a Chat Transcript Details resource. + + :ivar messages: List of chat transcript communication resources. + :vartype messages: list[~azure.mgmt.support.models.MessageProperties] + :ivar start_time: Time in UTC (ISO 8601 format) when the chat began. + :vartype start_time: ~datetime.datetime + """ + + messages: Optional[list["_models.MessageProperties"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """List of chat transcript communication resources.""" + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when the chat began.""" + + @overload + def __init__( + self, + *, + messages: Optional[list["_models.MessageProperties"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityInput(_Model): + """Input of CheckNameAvailability API. + + :ivar name: The resource name to validate. Required. + :vartype name: str + :ivar type: The type of resource. Required. Known values are: + "Microsoft.Support/supportTickets" and "Microsoft.Support/communications". + :vartype type: str or ~azure.mgmt.support.models.Type + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource name to validate. Required.""" + type: Union[str, "_models.Type"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of resource. Required. Known values are: \"Microsoft.Support/supportTickets\" and + \"Microsoft.Support/communications\".""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.Type"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CheckNameAvailabilityOutput(_Model): + """Output of check name availability API. + + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: The reason why the name is not available. + :vartype reason: str + :ivar message: The detailed error message describing why the name is not available. + :vartype message: str + """ + + name_available: Optional[bool] = rest_field(name="nameAvailable", visibility=["read"]) + """Indicates whether the name is available.""" + reason: Optional[str] = rest_field(visibility=["read"]) + """The reason why the name is not available.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The detailed error message describing why the name is not available.""" + + +class ClassificationService(_Model): + """Service Classification result object. + + :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] + """ + + service_id: Optional[str] = rest_field(name="serviceId", visibility=["read"]) + """Azure resource Id of the service.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Localized name of the azure service.""" + resource_types: Optional[list[str]] = rest_field( + name="resourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """List of applicable ARM resource types for this service.""" + + @overload + def __init__( + self, + *, + resource_types: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CommunicationDetails(ProxyResource): + """Object that represents a Communication resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + :ivar properties: Properties of the resource. Required. + :vartype properties: ~azure.mgmt.support.models.CommunicationDetailsProperties + """ + + properties: "_models.CommunicationDetailsProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the resource. Required.""" + + __flattened_items = ["communication_type", "communication_direction", "sender", "subject", "body", "created_date"] + + @overload + def __init__( + self, + *, + properties: "_models.CommunicationDetailsProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CommunicationDetailsProperties(_Model): + """Describes the properties of a communication resource. + + :ivar communication_type: Communication type. Known values are: "web" and "phone". + :vartype communication_type: str or ~azure.mgmt.support.models.CommunicationType + :ivar communication_direction: Direction of communication. Known values are: "inbound" and + "outbound". + :vartype communication_direction: str or ~azure.mgmt.support.models.CommunicationDirection + :ivar sender: Email address of the sender. This property is required if called by a service + principal. + :vartype sender: str + :ivar subject: Subject of the communication. Required. + :vartype subject: str + :ivar body: Body of the communication. Required. + :vartype body: str + :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. + :vartype created_date: ~datetime.datetime + """ + + communication_type: Optional[Union[str, "_models.CommunicationType"]] = rest_field( + name="communicationType", visibility=["read"] + ) + """Communication type. Known values are: \"web\" and \"phone\".""" + communication_direction: Optional[Union[str, "_models.CommunicationDirection"]] = rest_field( + name="communicationDirection", visibility=["read"] + ) + """Direction of communication. Known values are: \"inbound\" and \"outbound\".""" + sender: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Email address of the sender. This property is required if called by a service principal.""" + subject: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Subject of the communication. Required.""" + body: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Body of the communication. Required.""" + created_date: Optional[datetime.datetime] = rest_field(name="createdDate", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when the communication was created.""" + + @overload + def __init__( + self, + *, + subject: str, + body: str, + sender: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ContactProfile(_Model): + """Contact information associated with the support ticket. + + :ivar first_name: First name. Required. + :vartype first_name: str + :ivar last_name: Last name. Required. + :vartype last_name: str + :ivar preferred_contact_method: Preferred contact method. Required. Known values are: "email" + and "phone". + :vartype preferred_contact_method: str or ~azure.mgmt.support.models.PreferredContactMethod + :ivar primary_email_address: Primary email address. Required. + :vartype primary_email_address: str + :ivar additional_email_addresses: Additional email addresses listed will be copied on any + correspondence about the support ticket. + :vartype additional_email_addresses: list[str] + :ivar phone_number: Phone number. This is required if preferred contact method is phone. It is + also required when submitting 'critical' or 'highestcriticalimpact' severity cases. + :vartype phone_number: str + :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from + `Microsoft Time Zone Index Values + `_. Required. + :vartype preferred_time_zone: str + :ivar country: Country of the user. This is the ISO 3166-1 alpha-3 code. Required. + :vartype country: str + :ivar preferred_support_language: Preferred language of support from Azure. Support languages + vary based on the severity you choose for your support ticket. Learn more at `Azure Severity + and responsiveness `_. Use the standard + language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for + Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. + Required. + :vartype preferred_support_language: str + """ + + first_name: str = rest_field(name="firstName", visibility=["read", "create", "update", "delete", "query"]) + """First name. Required.""" + last_name: str = rest_field(name="lastName", visibility=["read", "create", "update", "delete", "query"]) + """Last name. Required.""" + preferred_contact_method: Union[str, "_models.PreferredContactMethod"] = rest_field( + name="preferredContactMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferred contact method. Required. Known values are: \"email\" and \"phone\".""" + primary_email_address: str = rest_field( + name="primaryEmailAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary email address. Required.""" + additional_email_addresses: Optional[list[str]] = rest_field( + name="additionalEmailAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional email addresses listed will be copied on any correspondence about the support + ticket.""" + phone_number: Optional[str] = rest_field( + name="phoneNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """Phone number. This is required if preferred contact method is phone. It is also required when + submitting 'critical' or 'highestcriticalimpact' severity cases.""" + preferred_time_zone: str = rest_field( + name="preferredTimeZone", visibility=["read", "create", "update", "delete", "query"] + ) + """Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values + `_. Required.""" + country: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Country of the user. This is the ISO 3166-1 alpha-3 code. Required.""" + preferred_support_language: str = rest_field( + name="preferredSupportLanguage", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferred language of support from Azure. Support languages vary based on the severity you + choose for your support ticket. Learn more at `Azure Severity and responsiveness + `_. Use the standard language-country code. + Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for + French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, 'pt-br' for Portuguese, + 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. Required.""" + + @overload + def __init__( + self, + *, + first_name: str, + last_name: str, + preferred_contact_method: Union[str, "_models.PreferredContactMethod"], + primary_email_address: str, + preferred_time_zone: str, + country: str, + preferred_support_language: str, + additional_email_addresses: Optional[list[str]] = None, + phone_number: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class DirectConnectEscalation(_Model): + """Direct Connect Escalation details for a support ticket. + + :ivar azure_ee_status: Status of Direct Connect Escalation. Known values are: + "EscalationAvailable", "EscalationInitiated", "EscalationProcessed", "EscalationUnsupported", + and "EscalationUnavailable". + :vartype azure_ee_status: str or ~azure.mgmt.support.models.EscalationStatus + :ivar allowed_severities: An array containing the allowed severities for direct connect + escalation. + :vartype allowed_severities: list[str or ~azure.mgmt.support.models.SeverityLevel] + :ivar reason_for_escalation: Reason for escalation / business impact. + :vartype reason_for_escalation: str + """ + + azure_ee_status: Optional[Union[str, "_models.EscalationStatus"]] = rest_field( + name="azureEEStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Status of Direct Connect Escalation. Known values are: \"EscalationAvailable\", + \"EscalationInitiated\", \"EscalationProcessed\", \"EscalationUnsupported\", and + \"EscalationUnavailable\".""" + allowed_severities: Optional[list[Union[str, "_models.SeverityLevel"]]] = rest_field( + name="allowedSeverities", visibility=["read", "create", "update", "delete", "query"] + ) + """An array containing the allowed severities for direct connect escalation.""" + reason_for_escalation: Optional[str] = rest_field( + name="reasonForEscalation", visibility=["read", "create", "update", "delete", "query"] + ) + """Reason for escalation / business impact.""" + + @overload + def __init__( + self, + *, + azure_ee_status: Optional[Union[str, "_models.EscalationStatus"]] = None, + allowed_severities: Optional[list[Union[str, "_models.SeverityLevel"]]] = None, + reason_for_escalation: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.support.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.support.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.support.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FileDetails(ProxyResource): + """Object that represents File Details resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + :ivar properties: Properties of the resource. + :vartype properties: ~azure.mgmt.support.models.FileDetailsProperties + """ + + properties: Optional["_models.FileDetailsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the resource.""" + + __flattened_items = ["created_on", "chunk_size", "file_size", "number_of_chunks"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.FileDetailsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FileDetailsProperties(_Model): + """Describes the properties of a file. + + :ivar created_on: Time in UTC (ISO 8601 format) when file workspace was created. + :vartype created_on: ~datetime.datetime + :ivar chunk_size: Size of each chunk. The size of each chunk should be provided in bytes and + must not exceed 2.5 megabytes (MB). + :vartype chunk_size: int + :ivar file_size: Size of the file to be uploaded. The file size must not exceed 5 MB and should + be provided in bytes. + :vartype file_size: int + :ivar number_of_chunks: Number of chunks to be uploaded. The maximum number of allowed chunks + is 2. + :vartype number_of_chunks: int + """ + + created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when file workspace was created.""" + chunk_size: Optional[int] = rest_field(name="chunkSize", visibility=["read", "create", "update", "delete", "query"]) + """Size of each chunk. The size of each chunk should be provided in bytes and must not exceed 2.5 + megabytes (MB).""" + file_size: Optional[int] = rest_field(name="fileSize", visibility=["read", "create", "update", "delete", "query"]) + """Size of the file to be uploaded. The file size must not exceed 5 MB and should be provided in + bytes.""" + number_of_chunks: Optional[int] = rest_field( + name="numberOfChunks", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of chunks to be uploaded. The maximum number of allowed chunks is 2.""" + + @overload + def __init__( + self, + *, + chunk_size: Optional[int] = None, + file_size: Optional[int] = None, + number_of_chunks: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class FileWorkspaceDetails(ProxyResource): + """Object that represents FileWorkspaceDetails resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + :ivar properties: Properties of the resource. + :vartype properties: ~azure.mgmt.support.models.FileWorkspaceDetailsProperties + """ + + properties: Optional["_models.FileWorkspaceDetailsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the resource.""" + + __flattened_items = ["created_on", "expiration_time"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.FileWorkspaceDetailsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class FileWorkspaceDetailsProperties(_Model): + """Describes the properties of a file workspace. + + :ivar created_on: Time in UTC (ISO 8601 format) when file workspace was created. + :vartype created_on: ~datetime.datetime + :ivar expiration_time: Time in UTC (ISO 8601 format) when file workspace is going to expire. + :vartype expiration_time: ~datetime.datetime + """ + + created_on: Optional[datetime.datetime] = rest_field(name="createdOn", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when file workspace was created.""" + expiration_time: Optional[datetime.datetime] = rest_field( + name="expirationTime", visibility=["read"], format="rfc3339" + ) + """Time in UTC (ISO 8601 format) when file workspace is going to expire.""" + + +class LookUpResourceIdRequest(_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 + """ + + identifier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The System generated Id that is unique. Use supportTicketId property for + Microsoft.Support/supportTickets resource type.""" + type: Optional[Literal["Microsoft.Support/supportTickets"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of resource. Default value is \"Microsoft.Support/supportTickets\".""" + + @overload + def __init__( + self, + *, + identifier: Optional[str] = None, + type: Optional[Literal["Microsoft.Support/supportTickets"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LookUpResourceIdResponse(_Model): + """The look up resource id response. + + :ivar resource_id: The resource Id of support resource type. + :vartype resource_id: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource Id of support resource type.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class MessageProperties(_Model): + """Describes the properties of a Message Details resource. + + :ivar content_type: Content type. + :vartype content_type: str + :ivar communication_direction: Direction of communication. Known values are: "inbound" and + "outbound". + :vartype communication_direction: str or ~azure.mgmt.support.models.CommunicationDirection + :ivar sender: Name of the sender. + :vartype sender: str + :ivar body: Body of the communication. + :vartype body: str + :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. + :vartype created_date: ~datetime.datetime + """ + + content_type: Optional[str] = rest_field(name="contentType", visibility=["read"]) + """Content type.""" + communication_direction: Optional[Union[str, "_models.CommunicationDirection"]] = rest_field( + name="communicationDirection", visibility=["read"] + ) + """Direction of communication. Known values are: \"inbound\" and \"outbound\".""" + sender: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the sender.""" + body: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Body of the communication.""" + created_date: Optional[datetime.datetime] = rest_field(name="createdDate", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when the communication was created.""" + + @overload + def __init__( + self, + *, + sender: Optional[str] = None, + body: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.support.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.support.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.support.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for an operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class ProblemClassification(ProxyResource): + """ProblemClassification resource object. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + :ivar properties: Properties of the resource. + :vartype properties: ~azure.mgmt.support.models.ProblemClassificationProperties + """ + + properties: Optional["_models.ProblemClassificationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the resource.""" + + __flattened_items = ["display_name", "secondary_consent_enabled"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ProblemClassificationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ProblemClassificationProperties(_Model): + """Details about a problem classification available for an Azure service. + + :ivar display_name: Localized name of problem classification. + :vartype display_name: str + :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] + """ + + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Localized name of problem classification.""" + secondary_consent_enabled: Optional[list["_models.SecondaryConsentEnabled"]] = rest_field( + name="secondaryConsentEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """This property indicates whether secondary consent is present for problem classification.""" + + @overload + def __init__( + self, + *, + display_name: Optional[str] = None, + secondary_consent_enabled: Optional[list["_models.SecondaryConsentEnabled"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProblemClassificationsClassificationInput(_Model): # pylint: disable=name-too-long + """Input to problem classification Classification API. + + :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 + """ + + issue_summary: str = rest_field(name="issueSummary", visibility=["read", "create", "update", "delete", "query"]) + """Natural language description of the customer’s issue. Required.""" + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM resource Id of the resource that is having the issue.""" + + @overload + def __init__( + self, + *, + issue_summary: str, + resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProblemClassificationsClassificationOutput(_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] + """ + + problem_classification_results: Optional[list["_models.ProblemClassificationsClassificationResult"]] = rest_field( + name="problemClassificationResults", visibility=["read", "create", "update", "delete", "query"] + ) + """Set of problem classification objects classified.""" + + @overload + def __init__( + self, + *, + problem_classification_results: Optional[list["_models.ProblemClassificationsClassificationResult"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ProblemClassificationsClassificationResult(_Model): # pylint: disable=name-too-long + """ProblemClassification Classification result object. + + :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 related_service: Related service. + :vartype related_service: ~azure.mgmt.support.models.ClassificationService + :ivar article_id: Identifier of the article associated with this problem classification result. + This value is populated only when a related article is available; otherwise it is omitted. + :vartype article_id: str + """ + + problem_id: Optional[str] = rest_field(name="problemId", visibility=["read"]) + """Identifier that may be used for solution discovery or some other purposes.""" + title: Optional[str] = rest_field(visibility=["read"]) + """Title of the problem classification result.""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description of the problem classification result.""" + service_id: Optional[str] = rest_field(name="serviceId", visibility=["read"]) + """Identifier of the service associated with this problem classification result.""" + problem_classification_id: Optional[str] = rest_field(name="problemClassificationId", visibility=["read"]) + """Identifier that may be used for support ticket creation.""" + related_service: Optional["_models.ClassificationService"] = rest_field( + name="relatedService", visibility=["read", "create", "update", "delete", "query"] + ) + """Related service.""" + article_id: Optional[str] = rest_field(name="articleId", visibility=["read"]) + """Identifier of the article associated with this problem classification result. This value is + populated only when a related article is available; otherwise it is omitted.""" + + @overload + def __init__( + self, + *, + related_service: Optional["_models.ClassificationService"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class QuotaChangeRequest(_Model): + """This property is required for providing the region and new quota limits. + + :ivar region: Region for which the quota increase request is being made. + :vartype region: str + :ivar payload: Payload of the quota increase request. + :vartype payload: str + """ + + region: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Region for which the quota increase request is being made.""" + payload: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Payload of the quota increase request.""" + + @overload + def __init__( + self, + *, + region: Optional[str] = None, + payload: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class QuotaTicketDetails(_Model): + """Additional set of information required for quota increase support ticket for certain quota + types, e.g.: Virtual machine cores. Get complete details about Quota payload support request + along with examples at `Support quota request `_. + + :ivar quota_change_request_sub_type: Required for certain quota types when there is a sub type, + such as Batch, for which you are requesting a quota increase. + :vartype quota_change_request_sub_type: str + :ivar quota_change_request_version: Quota change request version. + :vartype quota_change_request_version: str + :ivar quota_change_requests: This property is required for providing the region and new quota + limits. + :vartype quota_change_requests: list[~azure.mgmt.support.models.QuotaChangeRequest] + """ + + quota_change_request_sub_type: Optional[str] = rest_field( + name="quotaChangeRequestSubType", visibility=["read", "create", "update", "delete", "query"] + ) + """Required for certain quota types when there is a sub type, such as Batch, for which you are + requesting a quota increase.""" + quota_change_request_version: Optional[str] = rest_field( + name="quotaChangeRequestVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Quota change request version.""" + quota_change_requests: Optional[list["_models.QuotaChangeRequest"]] = rest_field( + name="quotaChangeRequests", visibility=["read", "create", "update", "delete", "query"] + ) + """This property is required for providing the region and new quota limits.""" + + @overload + def __init__( + self, + *, + quota_change_request_sub_type: Optional[str] = None, + quota_change_request_version: Optional[str] = None, + quota_change_requests: Optional[list["_models.QuotaChangeRequest"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecondaryConsent(_Model): + """This property indicates secondary consent for the support ticket. + + :ivar user_consent: User consent value provided. Known values are: "Yes" and "No". + :vartype user_consent: str or ~azure.mgmt.support.models.UserConsent + :ivar type: The service name for which the secondary consent is being provided. The value needs + to be retrieved from the Problem Classification API response. + :vartype type: str + """ + + user_consent: Optional[Union[str, "_models.UserConsent"]] = rest_field( + name="userConsent", visibility=["read", "create", "update", "delete", "query"] + ) + """User consent value provided. Known values are: \"Yes\" and \"No\".""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The service name for which the secondary consent is being provided. The value needs to be + retrieved from the Problem Classification API response.""" + + @overload + def __init__( + self, + *, + user_consent: Optional[Union[str, "_models.UserConsent"]] = None, + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SecondaryConsentEnabled(_Model): + """This property indicates whether secondary consent is present for problem classification. + + :ivar description: User consent description. + :vartype description: str + :ivar type: The Azure service for which secondary consent is needed for case creation. + :vartype type: str + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """User consent description.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The Azure service for which secondary consent is needed for case creation.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + type: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Service(ProxyResource): + """Object that represents a Service resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + :ivar properties: Properties of the resource. + :vartype properties: ~azure.mgmt.support.models.ServiceProperties + """ + + properties: Optional["_models.ServiceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the resource.""" + + __flattened_items = ["display_name", "resource_types"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ServiceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ServiceClassificationAnswer(ClassificationService): + """Service Classification result object. + + :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 + """ + + child_service: Optional["_models.ClassificationService"] = rest_field( + name="childService", visibility=["read", "create", "update", "delete", "query"] + ) + """Child service.""" + + @overload + def __init__( + self, + *, + resource_types: Optional[list[str]] = None, + child_service: Optional["_models.ClassificationService"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceClassificationOutput(_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] + """ + + service_classification_results: Optional[list["_models.ServiceClassificationAnswer"]] = rest_field( + name="serviceClassificationResults", visibility=["read", "create", "update", "delete", "query"] + ) + """Set of problem classification objects classified.""" + + @overload + def __init__( + self, + *, + service_classification_results: Optional[list["_models.ServiceClassificationAnswer"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceClassificationRequest(_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 + """ + + issue_summary: Optional[str] = rest_field( + name="issueSummary", visibility=["read", "create", "update", "delete", "query"] + ) + """Natural language description of the customer’s issue.""" + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM resource Id of the resource that is having the issue.""" + additional_context: Optional[str] = rest_field( + name="additionalContext", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional information in the form of a string.""" + + @overload + def __init__( + self, + *, + issue_summary: Optional[str] = None, + resource_id: Optional[str] = None, + additional_context: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ServiceLevelAgreement(_Model): + """Service Level Agreement details for a support ticket. + + :ivar start_time: Time in UTC (ISO 8601 format) when the service level agreement starts. + :vartype start_time: ~datetime.datetime + :ivar expiration_time: Time in UTC (ISO 8601 format) when the service level agreement expires. + :vartype expiration_time: ~datetime.datetime + :ivar sla_minutes: Service Level Agreement in minutes. + :vartype sla_minutes: int + """ + + start_time: Optional[datetime.datetime] = rest_field(name="startTime", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when the service level agreement starts.""" + expiration_time: Optional[datetime.datetime] = rest_field( + name="expirationTime", visibility=["read"], format="rfc3339" + ) + """Time in UTC (ISO 8601 format) when the service level agreement expires.""" + sla_minutes: Optional[int] = rest_field(name="slaMinutes", visibility=["read"]) + """Service Level Agreement in minutes.""" + + +class ServiceProperties(_Model): + """Details about an Azure service available for support ticket creation. + + :ivar display_name: Localized name of the Azure service. + :vartype display_name: str + :ivar resource_types: ARM Resource types. + :vartype resource_types: list[str] + """ + + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Localized name of the Azure service.""" + resource_types: Optional[list[str]] = rest_field( + name="resourceTypes", visibility=["read", "create", "update", "delete", "query"] + ) + """ARM Resource types.""" + + @overload + def __init__( + self, + *, + display_name: Optional[str] = None, + resource_types: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SupportEngineer(_Model): + """Support engineer information. + + :ivar email_address: Email address of the Azure Support engineer assigned to the support + ticket. + :vartype email_address: str + """ + + email_address: Optional[str] = rest_field(name="emailAddress", visibility=["read"]) + """Email address of the Azure Support engineer assigned to the support ticket.""" + + +class SupportTicketDetails(ProxyResource): + """Object that represents SupportTicketDetails resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.support.models.SystemData + :ivar properties: Properties of the resource. Required. + :vartype properties: ~azure.mgmt.support.models.SupportTicketDetailsProperties + """ + + properties: "_models.SupportTicketDetailsProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties of the resource. Required.""" + + __flattened_items = [ + "support_ticket_id", + "description", + "problem_classification_id", + "problem_classification_display_name", + "severity", + "enrollment_id", + "require24_x7_response", + "advanced_diagnostic_consent", + "problem_scoping_questions", + "support_plan_id", + "contact_details", + "service_level_agreement", + "support_engineer", + "support_plan_type", + "support_plan_display_name", + "title", + "problem_start_time", + "service_id", + "service_display_name", + "status", + "created_date", + "modified_date", + "file_workspace_name", + "is_temporary_ticket", + "technical_ticket_details", + "quota_ticket_details", + "secondary_consent", + "direct_connect_escalation", + "community_forum_post", + "support_channel", + "chat_conversation_status", + ] + + @overload + def __init__( + self, + *, + properties: "_models.SupportTicketDetailsProperties", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class SupportTicketDetailsProperties(_Model): + """Describes the properties of a support ticket. + + :ivar support_ticket_id: System generated support ticket Id that is unique. + :vartype support_ticket_id: str + :ivar description: Detailed description of the question or issue. Required. + :vartype description: str + :ivar problem_classification_id: Each Azure service has its own set of issue categories, also + known as problem classification. This parameter is the unique Id for the type of problem you + are experiencing. Required. + :vartype problem_classification_id: str + :ivar problem_classification_display_name: Localized name of problem classification. + :vartype problem_classification_display_name: str + :ivar severity: A value that indicates the urgency of the case, which in turn determines the + response time according to the service level agreement of the technical support plan you have + with Azure. Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' + level in the Azure portal is reserved only for our Premium customers. Required. Known values + are: "minimal", "moderate", "critical", and "highestcriticalimpact". + :vartype severity: str or ~azure.mgmt.support.models.SeverityLevel + :ivar enrollment_id: Enrollment Id associated with the support ticket. + :vartype enrollment_id: str + :ivar require24_x7_response: Indicates if this requires a 24x7 response from Azure. + :vartype require24_x7_response: bool + :ivar advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support + ticket. Required. Known values are: "Yes" and "No". + :vartype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent + :ivar problem_scoping_questions: Problem scoping questions associated with the support ticket. + :vartype problem_scoping_questions: str + :ivar support_plan_id: Support plan id associated with the support ticket. + :vartype support_plan_id: str + :ivar contact_details: Contact information of the user requesting to create a support ticket. + Required. + :vartype contact_details: ~azure.mgmt.support.models.ContactProfile + :ivar service_level_agreement: Service Level Agreement information for this support ticket. + :vartype service_level_agreement: ~azure.mgmt.support.models.ServiceLevelAgreement + :ivar support_engineer: Information about the support engineer working on this support ticket. + :vartype support_engineer: ~azure.mgmt.support.models.SupportEngineer + :ivar support_plan_type: Support plan type associated with the support ticket. + :vartype support_plan_type: str + :ivar support_plan_display_name: Support plan type associated with the support ticket. + :vartype support_plan_display_name: str + :ivar title: Title of the support ticket. Required. + :vartype title: str + :ivar problem_start_time: Time in UTC (ISO 8601 format) when the problem started. + :vartype problem_start_time: ~datetime.datetime + :ivar service_id: This is the resource Id of the Azure service resource associated with the + support ticket. Required. + :vartype service_id: str + :ivar service_display_name: Localized name of the Azure service. + :vartype service_display_name: str + :ivar status: Status of the support ticket. + :vartype status: str + :ivar created_date: Time in UTC (ISO 8601 format) when the support ticket was created. + :vartype created_date: ~datetime.datetime + :ivar modified_date: Time in UTC (ISO 8601 format) when the support ticket was last modified. + :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 + :ivar quota_ticket_details: Additional ticket details associated with a quota support ticket + request. + :vartype quota_ticket_details: ~azure.mgmt.support.models.QuotaTicketDetails + :ivar secondary_consent: This property indicates secondary consents for the support ticket. + :vartype secondary_consent: list[~azure.mgmt.support.models.SecondaryConsent] + :ivar direct_connect_escalation: Direct Connect Escalation details for a support ticket. + :vartype direct_connect_escalation: ~azure.mgmt.support.models.DirectConnectEscalation + :ivar community_forum_post: Contains a link to the post on the community forum. + :vartype community_forum_post: str + :ivar support_channel: Support channel type for the support ticket. Known values are: "Chat" + and "Web". + :vartype support_channel: str or ~azure.mgmt.support.models.SupportChannel + :ivar chat_conversation_status: Status of the chat conversation associated with the support + ticket. Known values are: "Active" and "Closed". + :vartype chat_conversation_status: str or ~azure.mgmt.support.models.ChatConversationStatus + """ + + support_ticket_id: Optional[str] = rest_field( + name="supportTicketId", visibility=["read", "create", "update", "delete", "query"] + ) + """System generated support ticket Id that is unique.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Detailed description of the question or issue. Required.""" + problem_classification_id: str = rest_field( + name="problemClassificationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Each Azure service has its own set of issue categories, also known as problem classification. + This parameter is the unique Id for the type of problem you are experiencing. Required.""" + problem_classification_display_name: Optional[str] = rest_field( + name="problemClassificationDisplayName", visibility=["read"] + ) + """Localized name of problem classification.""" + severity: Union[str, "_models.SeverityLevel"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A value that indicates the urgency of the case, which in turn determines the response time + according to the service level agreement of the technical support plan you have with Azure. + Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' level in the + Azure portal is reserved only for our Premium customers. Required. Known values are: + \"minimal\", \"moderate\", \"critical\", and \"highestcriticalimpact\".""" + enrollment_id: Optional[str] = rest_field( + name="enrollmentId", visibility=["read", "create", "update", "delete", "query"] + ) + """Enrollment Id associated with the support ticket.""" + require24_x7_response: Optional[bool] = rest_field( + name="require24X7Response", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if this requires a 24x7 response from Azure.""" + advanced_diagnostic_consent: Union[str, "_models.Consent"] = rest_field( + name="advancedDiagnosticConsent", visibility=["read", "create", "update", "delete", "query"] + ) + """Advanced diagnostic consent to be updated on the support ticket. Required. Known values are: + \"Yes\" and \"No\".""" + problem_scoping_questions: Optional[str] = rest_field( + name="problemScopingQuestions", visibility=["read", "create", "update", "delete", "query"] + ) + """Problem scoping questions associated with the support ticket.""" + support_plan_id: Optional[str] = rest_field( + name="supportPlanId", visibility=["read", "create", "update", "delete", "query"] + ) + """Support plan id associated with the support ticket.""" + contact_details: "_models.ContactProfile" = rest_field( + name="contactDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Contact information of the user requesting to create a support ticket. Required.""" + service_level_agreement: Optional["_models.ServiceLevelAgreement"] = rest_field( + name="serviceLevelAgreement", visibility=["read", "create", "update", "delete", "query"] + ) + """Service Level Agreement information for this support ticket.""" + support_engineer: Optional["_models.SupportEngineer"] = rest_field( + name="supportEngineer", visibility=["read", "create", "update", "delete", "query"] + ) + """Information about the support engineer working on this support ticket.""" + support_plan_type: Optional[str] = rest_field(name="supportPlanType", visibility=["read"]) + """Support plan type associated with the support ticket.""" + support_plan_display_name: Optional[str] = rest_field(name="supportPlanDisplayName", visibility=["read"]) + """Support plan type associated with the support ticket.""" + title: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Title of the support ticket. Required.""" + problem_start_time: Optional[datetime.datetime] = rest_field( + name="problemStartTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Time in UTC (ISO 8601 format) when the problem started.""" + service_id: str = rest_field(name="serviceId", visibility=["read", "create", "update", "delete", "query"]) + """This is the resource Id of the Azure service resource associated with the support ticket. + Required.""" + service_display_name: Optional[str] = rest_field(name="serviceDisplayName", visibility=["read"]) + """Localized name of the Azure service.""" + status: Optional[str] = rest_field(visibility=["read"]) + """Status of the support ticket.""" + created_date: Optional[datetime.datetime] = rest_field(name="createdDate", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when the support ticket was created.""" + modified_date: Optional[datetime.datetime] = rest_field(name="modifiedDate", visibility=["read"], format="rfc3339") + """Time in UTC (ISO 8601 format) when the support ticket was last modified.""" + file_workspace_name: Optional[str] = rest_field( + name="fileWorkspaceName", visibility=["read", "create", "update", "delete", "query"] + ) + """File workspace name.""" + is_temporary_ticket: Optional[Union[str, "_models.IsTemporaryTicket"]] = rest_field( + name="isTemporaryTicket", visibility=["read"] + ) + """This property indicates if support ticket is a temporary ticket. Known values are: \"Yes\" and + \"No\".""" + technical_ticket_details: Optional["_models.TechnicalTicketDetails"] = rest_field( + name="technicalTicketDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional ticket details associated with a technical support ticket request.""" + quota_ticket_details: Optional["_models.QuotaTicketDetails"] = rest_field( + name="quotaTicketDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional ticket details associated with a quota support ticket request.""" + secondary_consent: Optional[list["_models.SecondaryConsent"]] = rest_field( + name="secondaryConsent", visibility=["read", "create", "update", "delete", "query"] + ) + """This property indicates secondary consents for the support ticket.""" + direct_connect_escalation: Optional["_models.DirectConnectEscalation"] = rest_field( + name="directConnectEscalation", visibility=["read", "create", "update", "delete", "query"] + ) + """Direct Connect Escalation details for a support ticket.""" + community_forum_post: Optional[str] = rest_field( + name="communityForumPost", visibility=["read", "create", "update", "delete", "query"] + ) + """Contains a link to the post on the community forum.""" + support_channel: Optional[Union[str, "_models.SupportChannel"]] = rest_field( + name="supportChannel", visibility=["read"] + ) + """Support channel type for the support ticket. Known values are: \"Chat\" and \"Web\".""" + chat_conversation_status: Optional[Union[str, "_models.ChatConversationStatus"]] = rest_field( + name="chatConversationStatus", visibility=["read"] + ) + """Status of the chat conversation associated with the support ticket. Known values are: + \"Active\" and \"Closed\".""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + description: str, + problem_classification_id: str, + severity: Union[str, "_models.SeverityLevel"], + advanced_diagnostic_consent: Union[str, "_models.Consent"], + contact_details: "_models.ContactProfile", + title: str, + service_id: str, + support_ticket_id: Optional[str] = None, + enrollment_id: Optional[str] = None, + require24_x7_response: Optional[bool] = None, + problem_scoping_questions: Optional[str] = None, + support_plan_id: Optional[str] = None, + service_level_agreement: Optional["_models.ServiceLevelAgreement"] = None, + support_engineer: Optional["_models.SupportEngineer"] = None, + problem_start_time: Optional[datetime.datetime] = None, + file_workspace_name: Optional[str] = None, + technical_ticket_details: Optional["_models.TechnicalTicketDetails"] = None, + quota_ticket_details: Optional["_models.QuotaTicketDetails"] = None, + secondary_consent: Optional[list["_models.SecondaryConsent"]] = None, + direct_connect_escalation: Optional["_models.DirectConnectEscalation"] = None, + community_forum_post: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.support.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.support.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TechnicalTicketDetails(_Model): + """Additional information for technical support ticket. + + :ivar resource_id: This is the resource Id of the Azure service resource (For example: A + virtual machine resource or an HDInsight resource) for which the support ticket is created. + :vartype resource_id: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """This is the resource Id of the Azure service resource (For example: A virtual machine resource + or an HDInsight resource) for which the support ticket is created.""" + + @overload + def __init__( + self, + *, + resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateContactProfile(_Model): + """Contact information associated with the support ticket. + + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar preferred_contact_method: Preferred contact method. Known values are: "email" and + "phone". + :vartype preferred_contact_method: str or ~azure.mgmt.support.models.PreferredContactMethod + :ivar primary_email_address: Primary email address. + :vartype primary_email_address: str + :ivar additional_email_addresses: Email addresses listed will be copied on any correspondence + about the support ticket. + :vartype additional_email_addresses: list[str] + :ivar phone_number: Phone number. This is required if preferred contact method is phone. It is + also required when submitting 'critical' or 'highestcriticalimpact' severity cases. + :vartype phone_number: str + :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from + `Microsoft Time Zone Index Values + `_. + :vartype preferred_time_zone: str + :ivar country: Country of the user. This is the ISO 3166-1 alpha-3 code. + :vartype country: str + :ivar preferred_support_language: Preferred language of support from Azure. Support languages + vary based on the severity you choose for your support ticket. Learn more at `Azure Severity + and responsiveness `_. Use the standard + language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for + Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. + :vartype preferred_support_language: str + """ + + first_name: Optional[str] = rest_field(name="firstName", visibility=["read", "create", "update", "delete", "query"]) + """First name.""" + last_name: Optional[str] = rest_field(name="lastName", visibility=["read", "create", "update", "delete", "query"]) + """Last name.""" + preferred_contact_method: Optional[Union[str, "_models.PreferredContactMethod"]] = rest_field( + name="preferredContactMethod", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferred contact method. Known values are: \"email\" and \"phone\".""" + primary_email_address: Optional[str] = rest_field( + name="primaryEmailAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Primary email address.""" + additional_email_addresses: Optional[list[str]] = rest_field( + name="additionalEmailAddresses", visibility=["read", "create", "update", "delete", "query"] + ) + """Email addresses listed will be copied on any correspondence about the support ticket.""" + phone_number: Optional[str] = rest_field( + name="phoneNumber", visibility=["read", "create", "update", "delete", "query"] + ) + """Phone number. This is required if preferred contact method is phone. It is also required when + submitting 'critical' or 'highestcriticalimpact' severity cases.""" + preferred_time_zone: Optional[str] = rest_field( + name="preferredTimeZone", visibility=["read", "create", "update", "delete", "query"] + ) + """Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values + `_.""" + country: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Country of the user. This is the ISO 3166-1 alpha-3 code.""" + preferred_support_language: Optional[str] = rest_field( + name="preferredSupportLanguage", visibility=["read", "create", "update", "delete", "query"] + ) + """Preferred language of support from Azure. Support languages vary based on the severity you + choose for your support ticket. Learn more at `Azure Severity and responsiveness + `_. Use the standard language-country + code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' + for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, 'pt-br' for + Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German.""" + + @overload + def __init__( + self, + *, + first_name: Optional[str] = None, + last_name: Optional[str] = None, + preferred_contact_method: Optional[Union[str, "_models.PreferredContactMethod"]] = None, + primary_email_address: Optional[str] = None, + additional_email_addresses: Optional[list[str]] = None, + phone_number: Optional[str] = None, + preferred_time_zone: Optional[str] = None, + country: Optional[str] = None, + preferred_support_language: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UpdateSupportTicket(_Model): + """Updates severity, ticket status, contact details, advanced diagnostic consent and secondary + consent in the support ticket. + + :ivar severity: Severity level. Known values are: "minimal", "moderate", "critical", and + "highestcriticalimpact". + :vartype severity: str or ~azure.mgmt.support.models.SeverityLevel + :ivar status: Status to be updated on the ticket. Known values are: "open" and "closed". + :vartype status: str or ~azure.mgmt.support.models.Status + :ivar contact_details: Contact details to be updated on the support ticket. + :vartype contact_details: ~azure.mgmt.support.models.UpdateContactProfile + :ivar advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support + ticket. Known values are: "Yes" and "No". + :vartype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent + :ivar secondary_consent: This property indicates secondary consents for the support ticket. + :vartype secondary_consent: list[~azure.mgmt.support.models.SecondaryConsent] + :ivar direct_connect_escalation: Direct Connect Escalation details for a support ticket. + :vartype direct_connect_escalation: ~azure.mgmt.support.models.DirectConnectEscalation + """ + + severity: Optional[Union[str, "_models.SeverityLevel"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Severity level. Known values are: \"minimal\", \"moderate\", \"critical\", and + \"highestcriticalimpact\".""" + status: Optional[Union[str, "_models.Status"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Status to be updated on the ticket. Known values are: \"open\" and \"closed\".""" + contact_details: Optional["_models.UpdateContactProfile"] = rest_field( + name="contactDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Contact details to be updated on the support ticket.""" + advanced_diagnostic_consent: Optional[Union[str, "_models.Consent"]] = rest_field( + name="advancedDiagnosticConsent", visibility=["read", "create", "update", "delete", "query"] + ) + """Advanced diagnostic consent to be updated on the support ticket. Known values are: \"Yes\" and + \"No\".""" + secondary_consent: Optional[list["_models.SecondaryConsent"]] = rest_field( + name="secondaryConsent", visibility=["read", "create", "update", "delete", "query"] + ) + """This property indicates secondary consents for the support ticket.""" + direct_connect_escalation: Optional["_models.DirectConnectEscalation"] = rest_field( + name="directConnectEscalation", visibility=["read", "create", "update", "delete", "query"] + ) + """Direct Connect Escalation details for a support ticket.""" + + @overload + def __init__( + self, + *, + severity: Optional[Union[str, "_models.SeverityLevel"]] = None, + status: Optional[Union[str, "_models.Status"]] = None, + contact_details: Optional["_models.UpdateContactProfile"] = None, + advanced_diagnostic_consent: Optional[Union[str, "_models.Consent"]] = None, + secondary_consent: Optional[list["_models.SecondaryConsent"]] = None, + direct_connect_escalation: Optional["_models.DirectConnectEscalation"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UploadFile(_Model): + """File content associated with the file under a workspace. + + :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: int + """ + + content: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """File Content in base64 encoded format.""" + chunk_index: Optional[int] = rest_field( + name="chunkIndex", visibility=["read", "create", "update", "delete", "query"] + ) + """Index of the uploaded chunk (Index starts at 0).""" + + @overload + def __init__( + self, + *, + content: Optional[str] = None, + chunk_index: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) 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 deleted file mode 100644 index cb92810f43f2..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_models_py3.py +++ /dev/null @@ -1,1699 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.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) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.support.models.SystemData - """ - - -class ChatTranscriptDetails(ProxyResource): - """Object that represents a Chat Transcript resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.support.models.SystemData - :ivar messages: List of chat transcript communication resources. - :vartype messages: list[~azure.mgmt.support.models.MessageProperties] - :ivar start_time: Time in UTC (ISO 8601 format) when the chat began. - :vartype start_time: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "start_time": {"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"}, - "messages": {"key": "properties.messages", "type": "[MessageProperties]"}, - "start_time": {"key": "properties.startTime", "type": "iso-8601"}, - } - - def __init__(self, *, messages: Optional[List["_models.MessageProperties"]] = None, **kwargs: Any) -> None: - """ - :keyword messages: List of chat transcript communication resources. - :paramtype messages: list[~azure.mgmt.support.models.MessageProperties] - """ - super().__init__(**kwargs) - self.messages = messages - self.start_time = None - - -class ChatTranscriptsListResult(_serialization.Model): - """Collection of Chat Transcripts resources. - - :ivar value: List of Chat Transcripts resources. - :vartype value: list[~azure.mgmt.support.models.ChatTranscriptDetails] - :ivar next_link: The URI to fetch the next page of Chat Transcripts resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ChatTranscriptDetails]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ChatTranscriptDetails"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: List of Chat Transcripts resources. - :paramtype value: list[~azure.mgmt.support.models.ChatTranscriptDetails] - :keyword next_link: The URI to fetch the next page of Chat Transcripts resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CheckNameAvailabilityInput(_serialization.Model): - """Input of CheckNameAvailability API. - - All required parameters must be populated in order to send to server. - - :ivar name: The resource name to validate. Required. - :vartype name: str - :ivar type: The type of resource. Required. Known values are: - "Microsoft.Support/supportTickets" and "Microsoft.Support/communications". - :vartype type: str or ~azure.mgmt.support.models.Type - """ - - _validation = { - "name": {"required": True}, - "type": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, name: str, type: Union[str, "_models.Type"], **kwargs: Any) -> None: - """ - :keyword name: The resource name to validate. Required. - :paramtype name: str - :keyword type: The type of resource. Required. Known values are: - "Microsoft.Support/supportTickets" and "Microsoft.Support/communications". - :paramtype type: str or ~azure.mgmt.support.models.Type - """ - super().__init__(**kwargs) - self.name = name - self.type = type - - -class CheckNameAvailabilityOutput(_serialization.Model): - """Output of check name availability API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name_available: Indicates whether the name is available. - :vartype name_available: bool - :ivar reason: The reason why the name is not available. - :vartype reason: str - :ivar message: The detailed error message describing why the name is not available. - :vartype message: str - """ - - _validation = { - "name_available": {"readonly": True}, - "reason": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name_available = None - self.reason = None - self.message = None - - -class CommunicationDetails(_serialization.Model): - """Object that represents a Communication resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Id of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of the resource 'Microsoft.Support/communications'. - :vartype type: str - :ivar communication_type: Communication type. Known values are: "web" and "phone". - :vartype communication_type: str or ~azure.mgmt.support.models.CommunicationType - :ivar communication_direction: Direction of communication. Known values are: "inbound" and - "outbound". - :vartype communication_direction: str or ~azure.mgmt.support.models.CommunicationDirection - :ivar sender: Email address of the sender. This property is required if called by a service - principal. - :vartype sender: str - :ivar subject: Subject of the communication. Required. - :vartype subject: str - :ivar body: Body of the communication. Required. - :vartype body: str - :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. - :vartype created_date: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "communication_type": {"readonly": True}, - "communication_direction": {"readonly": True}, - "subject": {"required": True}, - "body": {"required": True}, - "created_date": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "communication_type": {"key": "properties.communicationType", "type": "str"}, - "communication_direction": {"key": "properties.communicationDirection", "type": "str"}, - "sender": {"key": "properties.sender", "type": "str"}, - "subject": {"key": "properties.subject", "type": "str"}, - "body": {"key": "properties.body", "type": "str"}, - "created_date": {"key": "properties.createdDate", "type": "iso-8601"}, - } - - def __init__(self, *, subject: str, body: str, sender: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword sender: Email address of the sender. This property is required if called by a service - principal. - :paramtype sender: str - :keyword subject: Subject of the communication. Required. - :paramtype subject: str - :keyword body: Body of the communication. Required. - :paramtype body: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.communication_type = None - self.communication_direction = None - self.sender = sender - self.subject = subject - self.body = body - self.created_date = None - - -class CommunicationsListResult(_serialization.Model): - """Collection of Communication resources. - - :ivar value: List of Communication resources. - :vartype value: list[~azure.mgmt.support.models.CommunicationDetails] - :ivar next_link: The URI to fetch the next page of Communication resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CommunicationDetails]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.CommunicationDetails"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: List of Communication resources. - :paramtype value: list[~azure.mgmt.support.models.CommunicationDetails] - :keyword next_link: The URI to fetch the next page of Communication resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ContactProfile(_serialization.Model): - """Contact information associated with the support ticket. - - All required parameters must be populated in order to send to server. - - :ivar first_name: First name. Required. - :vartype first_name: str - :ivar last_name: Last name. Required. - :vartype last_name: str - :ivar preferred_contact_method: Preferred contact method. Required. Known values are: "email" - and "phone". - :vartype preferred_contact_method: str or ~azure.mgmt.support.models.PreferredContactMethod - :ivar primary_email_address: Primary email address. Required. - :vartype primary_email_address: str - :ivar additional_email_addresses: Additional email addresses listed will be copied on any - correspondence about the support ticket. - :vartype additional_email_addresses: list[str] - :ivar phone_number: Phone number. This is required if preferred contact method is phone. - :vartype phone_number: str - :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from - `Microsoft Time Zone Index Values - `_. Required. - :vartype preferred_time_zone: str - :ivar country: Country of the user. This is the ISO 3166-1 alpha-3 code. Required. - :vartype country: str - :ivar preferred_support_language: Preferred language of support from Azure. Support languages - vary based on the severity you choose for your support ticket. Learn more at `Azure Severity - and responsiveness `_. Use the standard - language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for - Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, - 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. - Required. - :vartype preferred_support_language: str - """ - - _validation = { - "first_name": {"required": True}, - "last_name": {"required": True}, - "preferred_contact_method": {"required": True}, - "primary_email_address": {"required": True}, - "preferred_time_zone": {"required": True}, - "country": {"required": True}, - "preferred_support_language": {"required": True}, - } - - _attribute_map = { - "first_name": {"key": "firstName", "type": "str"}, - "last_name": {"key": "lastName", "type": "str"}, - "preferred_contact_method": {"key": "preferredContactMethod", "type": "str"}, - "primary_email_address": {"key": "primaryEmailAddress", "type": "str"}, - "additional_email_addresses": {"key": "additionalEmailAddresses", "type": "[str]"}, - "phone_number": {"key": "phoneNumber", "type": "str"}, - "preferred_time_zone": {"key": "preferredTimeZone", "type": "str"}, - "country": {"key": "country", "type": "str"}, - "preferred_support_language": {"key": "preferredSupportLanguage", "type": "str"}, - } - - def __init__( - self, - *, - first_name: str, - last_name: str, - preferred_contact_method: Union[str, "_models.PreferredContactMethod"], - primary_email_address: str, - preferred_time_zone: str, - country: str, - preferred_support_language: str, - additional_email_addresses: Optional[List[str]] = None, - phone_number: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword first_name: First name. Required. - :paramtype first_name: str - :keyword last_name: Last name. Required. - :paramtype last_name: str - :keyword preferred_contact_method: Preferred contact method. Required. Known values are: - "email" and "phone". - :paramtype preferred_contact_method: str or ~azure.mgmt.support.models.PreferredContactMethod - :keyword primary_email_address: Primary email address. Required. - :paramtype primary_email_address: str - :keyword additional_email_addresses: Additional email addresses listed will be copied on any - correspondence about the support ticket. - :paramtype additional_email_addresses: list[str] - :keyword phone_number: Phone number. This is required if preferred contact method is phone. - :paramtype phone_number: str - :keyword preferred_time_zone: Time zone of the user. This is the name of the time zone from - `Microsoft Time Zone Index Values - `_. Required. - :paramtype preferred_time_zone: str - :keyword country: Country of the user. This is the ISO 3166-1 alpha-3 code. Required. - :paramtype country: str - :keyword preferred_support_language: Preferred language of support from Azure. Support - languages vary based on the severity you choose for your support ticket. Learn more at `Azure - Severity and responsiveness `_. Use the - standard language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, - 'es-es' for Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for - Russian, 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for - German. Required. - :paramtype preferred_support_language: str - """ - super().__init__(**kwargs) - self.first_name = first_name - self.last_name = last_name - self.preferred_contact_method = preferred_contact_method - self.primary_email_address = primary_email_address - self.additional_email_addresses = additional_email_addresses - self.phone_number = phone_number - self.preferred_time_zone = preferred_time_zone - self.country = country - self.preferred_support_language = preferred_support_language - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.support.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.support.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.support.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.support.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class FileDetails(ProxyResource): - """Object that represents File Details resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.support.models.SystemData - :ivar created_on: Time in UTC (ISO 8601 format) when file workspace was created. - :vartype created_on: ~datetime.datetime - :ivar chunk_size: Size of each chunk. The size of each chunk should be provided in bytes and - must not exceed 2.5 megabytes (MB). - :vartype chunk_size: int - :ivar file_size: Size of the file to be uploaded. The file size must not exceed 5 MB and should - be provided in bytes. - :vartype file_size: int - :ivar number_of_chunks: Number of chunks to be uploaded. The maximum number of allowed chunks - is 2. - :vartype number_of_chunks: int - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "created_on": {"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"}, - "created_on": {"key": "properties.createdOn", "type": "iso-8601"}, - "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[int] = None, - file_size: Optional[int] = None, - number_of_chunks: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword chunk_size: Size of each chunk. The size of each chunk should be provided in bytes and - must not exceed 2.5 megabytes (MB). - :paramtype chunk_size: int - :keyword file_size: Size of the file to be uploaded. The file size must not exceed 5 MB and - should be provided in bytes. - :paramtype file_size: int - :keyword number_of_chunks: Number of chunks to be uploaded. The maximum number of allowed - chunks is 2. - :paramtype number_of_chunks: int - """ - super().__init__(**kwargs) - self.created_on = None - self.chunk_size = chunk_size - self.file_size = file_size - self.number_of_chunks = number_of_chunks - - -class FilesListResult(_serialization.Model): - """Object that represents a collection of File resources. - - :ivar value: List of File resources. - :vartype value: list[~azure.mgmt.support.models.FileDetails] - :ivar next_link: The URI to fetch the next page of File resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[FileDetails]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.FileDetails"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of File resources. - :paramtype value: list[~azure.mgmt.support.models.FileDetails] - :keyword next_link: The URI to fetch the next page of File resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FileWorkspaceDetails(ProxyResource): - """Object that represents FileWorkspaceDetails resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.support.models.SystemData - :ivar created_on: Time in UTC (ISO 8601 format) when file workspace was created. - :vartype created_on: ~datetime.datetime - :ivar expiration_time: Time in UTC (ISO 8601 format) when file workspace is going to expire. - :vartype expiration_time: ~datetime.datetime - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "created_on": {"readonly": True}, - "expiration_time": {"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"}, - "created_on": {"key": "properties.createdOn", "type": "iso-8601"}, - "expiration_time": {"key": "properties.expirationTime", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.created_on = None - self.expiration_time = None - - -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. - - :ivar content_type: Content type. - :vartype content_type: str or ~azure.mgmt.support.models.TranscriptContentType - :ivar communication_direction: Direction of communication. Known values are: "inbound" and - "outbound". - :vartype communication_direction: str or ~azure.mgmt.support.models.CommunicationDirection - :ivar sender: Name of the sender. - :vartype sender: str - :ivar body: Body of the communication. - :vartype body: str - :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. - :vartype created_date: ~datetime.datetime - """ - - _validation = { - "content_type": {"readonly": True}, - "communication_direction": {"readonly": True}, - "created_date": {"readonly": True}, - } - - _attribute_map = { - "content_type": {"key": "contentType", "type": "str"}, - "communication_direction": {"key": "communicationDirection", "type": "str"}, - "sender": {"key": "sender", "type": "str"}, - "body": {"key": "body", "type": "str"}, - "created_date": {"key": "createdDate", "type": "iso-8601"}, - } - - def __init__(self, *, sender: Optional[str] = None, body: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword sender: Name of the sender. - :paramtype sender: str - :keyword body: Body of the communication. - :paramtype body: str - """ - super().__init__(**kwargs) - self.content_type = None - self.communication_direction = None - self.sender = sender - self.body = body - self.created_date = None - - -class Operation(_serialization.Model): - """The operation supported by Microsoft Support resource provider. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Operation name: {provider}/{resource}/{operation}. - :vartype name: str - :ivar display: The object that describes the operation. - :vartype display: ~azure.mgmt.support.models.OperationDisplay - """ - - _validation = { - "name": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationDisplay"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: The object that describes the operation. - :paramtype display: ~azure.mgmt.support.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.display = display - - -class OperationDisplay(_serialization.Model): - """The object that describes the operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar description: The description of the operation. - :vartype description: str - :ivar operation: The action that users can perform, based on their permission level. - :vartype operation: str - :ivar provider: Service provider: Microsoft Support. - :vartype provider: str - :ivar resource: Resource on which the operation is performed. - :vartype resource: str - """ - - _validation = { - "description": {"readonly": True}, - "operation": {"readonly": True}, - "provider": {"readonly": True}, - "resource": {"readonly": True}, - } - - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.description = None - self.operation = None - self.provider = None - self.resource = None - - -class OperationsListResult(_serialization.Model): - """The list of operations supported by Microsoft Support resource provider. - - :ivar value: The list of operations supported by Microsoft Support resource provider. - :vartype value: list[~azure.mgmt.support.models.Operation] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - } - - def __init__(self, *, value: Optional[List["_models.Operation"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of operations supported by Microsoft Support resource provider. - :paramtype value: list[~azure.mgmt.support.models.Operation] - """ - super().__init__(**kwargs) - self.value = value - - -class ProblemClassification(_serialization.Model): - """ProblemClassification resource object. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of the resource 'Microsoft.Support/problemClassification'. - :vartype type: str - :ivar display_name: Localized name of problem classification. - :vartype display_name: str - :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] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "secondary_consent_enabled": {"key": "properties.secondaryConsentEnabled", "type": "[SecondaryConsentEnabled]"}, - } - - def __init__( - self, - *, - display_name: Optional[str] = None, - secondary_consent_enabled: Optional[List["_models.SecondaryConsentEnabled"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword display_name: Localized name of problem classification. - :paramtype display_name: str - :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] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.display_name = display_name - self.secondary_consent_enabled = secondary_consent_enabled - - -class ProblemClassificationsListResult(_serialization.Model): - """Collection of ProblemClassification resources. - - :ivar value: List of ProblemClassification resources. - :vartype value: list[~azure.mgmt.support.models.ProblemClassification] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ProblemClassification]"}, - } - - def __init__(self, *, value: Optional[List["_models.ProblemClassification"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of ProblemClassification resources. - :paramtype value: list[~azure.mgmt.support.models.ProblemClassification] - """ - super().__init__(**kwargs) - self.value = value - - -class QuotaChangeRequest(_serialization.Model): - """This property is required for providing the region and new quota limits. - - :ivar region: Region for which the quota increase request is being made. - :vartype region: str - :ivar payload: Payload of the quota increase request. - :vartype payload: str - """ - - _attribute_map = { - "region": {"key": "region", "type": "str"}, - "payload": {"key": "payload", "type": "str"}, - } - - def __init__(self, *, region: Optional[str] = None, payload: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword region: Region for which the quota increase request is being made. - :paramtype region: str - :keyword payload: Payload of the quota increase request. - :paramtype payload: str - """ - super().__init__(**kwargs) - self.region = region - self.payload = payload - - -class QuotaTicketDetails(_serialization.Model): - """Additional set of information required for quota increase support ticket for certain quota - types, e.g.: Virtual machine cores. Get complete details about Quota payload support request - along with examples at `Support quota request `_. - - :ivar quota_change_request_sub_type: Required for certain quota types when there is a sub type, - such as Batch, for which you are requesting a quota increase. - :vartype quota_change_request_sub_type: str - :ivar quota_change_request_version: Quota change request version. - :vartype quota_change_request_version: str - :ivar quota_change_requests: This property is required for providing the region and new quota - limits. - :vartype quota_change_requests: list[~azure.mgmt.support.models.QuotaChangeRequest] - """ - - _attribute_map = { - "quota_change_request_sub_type": {"key": "quotaChangeRequestSubType", "type": "str"}, - "quota_change_request_version": {"key": "quotaChangeRequestVersion", "type": "str"}, - "quota_change_requests": {"key": "quotaChangeRequests", "type": "[QuotaChangeRequest]"}, - } - - def __init__( - self, - *, - quota_change_request_sub_type: Optional[str] = None, - quota_change_request_version: Optional[str] = None, - quota_change_requests: Optional[List["_models.QuotaChangeRequest"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword quota_change_request_sub_type: Required for certain quota types when there is a sub - type, such as Batch, for which you are requesting a quota increase. - :paramtype quota_change_request_sub_type: str - :keyword quota_change_request_version: Quota change request version. - :paramtype quota_change_request_version: str - :keyword quota_change_requests: This property is required for providing the region and new - quota limits. - :paramtype quota_change_requests: list[~azure.mgmt.support.models.QuotaChangeRequest] - """ - super().__init__(**kwargs) - self.quota_change_request_sub_type = quota_change_request_sub_type - self.quota_change_request_version = quota_change_request_version - self.quota_change_requests = quota_change_requests - - -class SecondaryConsent(_serialization.Model): - """This property indicates secondary consent for the support ticket. - - :ivar user_consent: User consent value provided. Known values are: "Yes" and "No". - :vartype user_consent: str or ~azure.mgmt.support.models.UserConsent - :ivar type: The service name for which the secondary consent is being provided. The value needs - to be retrieved from the Problem Classification API response. - :vartype type: str - """ - - _attribute_map = { - "user_consent": {"key": "userConsent", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - user_consent: Optional[Union[str, "_models.UserConsent"]] = None, - type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_consent: User consent value provided. Known values are: "Yes" and "No". - :paramtype user_consent: str or ~azure.mgmt.support.models.UserConsent - :keyword type: The service name for which the secondary consent is being provided. The value - needs to be retrieved from the Problem Classification API response. - :paramtype type: str - """ - super().__init__(**kwargs) - self.user_consent = user_consent - self.type = type - - -class SecondaryConsentEnabled(_serialization.Model): - """This property indicates whether secondary consent is present for problem classification. - - :ivar description: User consent description. - :vartype description: str - :ivar type: The Azure service for which secondary consent is needed for case creation. - :vartype type: str - """ - - _attribute_map = { - "description": {"key": "description", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, description: Optional[str] = None, type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword description: User consent description. - :paramtype description: str - :keyword type: The Azure service for which secondary consent is needed for case creation. - :paramtype type: str - """ - super().__init__(**kwargs) - self.description = description - self.type = type - - -class Service(_serialization.Model): - """Object that represents a Service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Id of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of the resource 'Microsoft.Support/services'. - :vartype type: str - :ivar display_name: Localized name of the Azure service. - :vartype display_name: str - :ivar resource_types: ARM Resource types. - :vartype resource_types: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "resource_types": {"key": "properties.resourceTypes", "type": "[str]"}, - } - - def __init__( - self, *, display_name: Optional[str] = None, resource_types: Optional[List[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword display_name: Localized name of the Azure service. - :paramtype display_name: str - :keyword resource_types: ARM Resource types. - :paramtype resource_types: list[str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.display_name = display_name - self.resource_types = resource_types - - -class ServiceLevelAgreement(_serialization.Model): - """Service Level Agreement details for a support ticket. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: Time in UTC (ISO 8601 format) when the service level agreement starts. - :vartype start_time: ~datetime.datetime - :ivar expiration_time: Time in UTC (ISO 8601 format) when the service level agreement expires. - :vartype expiration_time: ~datetime.datetime - :ivar sla_minutes: Service Level Agreement in minutes. - :vartype sla_minutes: int - """ - - _validation = { - "start_time": {"readonly": True}, - "expiration_time": {"readonly": True}, - "sla_minutes": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "expiration_time": {"key": "expirationTime", "type": "iso-8601"}, - "sla_minutes": {"key": "slaMinutes", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.start_time = None - self.expiration_time = None - self.sla_minutes = None - - -class ServicesListResult(_serialization.Model): - """Collection of Service resources. - - :ivar value: List of Service resources. - :vartype value: list[~azure.mgmt.support.models.Service] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Service]"}, - } - - def __init__(self, *, value: Optional[List["_models.Service"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of Service resources. - :paramtype value: list[~azure.mgmt.support.models.Service] - """ - super().__init__(**kwargs) - self.value = value - - -class SupportEngineer(_serialization.Model): - """Support engineer information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar email_address: Email address of the Azure Support engineer assigned to the support - ticket. - :vartype email_address: str - """ - - _validation = { - "email_address": {"readonly": True}, - } - - _attribute_map = { - "email_address": {"key": "emailAddress", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.email_address = None - - -class SupportTicketDetails(_serialization.Model): # pylint: disable=too-many-instance-attributes - """Object that represents SupportTicketDetails resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Id of the resource. - :vartype id: str - :ivar name: Name of the resource. - :vartype name: str - :ivar type: Type of the resource 'Microsoft.Support/supportTickets'. - :vartype type: str - :ivar support_ticket_id: System generated support ticket Id that is unique. - :vartype support_ticket_id: str - :ivar description: Detailed description of the question or issue. Required. - :vartype description: str - :ivar problem_classification_id: Each Azure service has its own set of issue categories, also - known as problem classification. This parameter is the unique Id for the type of problem you - are experiencing. Required. - :vartype problem_classification_id: str - :ivar problem_classification_display_name: Localized name of problem classification. - :vartype problem_classification_display_name: str - :ivar severity: A value that indicates the urgency of the case, which in turn determines the - response time according to the service level agreement of the technical support plan you have - with Azure. Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' - level in the Azure portal is reserved only for our Premium customers. Required. Known values - are: "minimal", "moderate", "critical", and "highestcriticalimpact". - :vartype severity: str or ~azure.mgmt.support.models.SeverityLevel - :ivar enrollment_id: Enrollment Id associated with the support ticket. - :vartype enrollment_id: str - :ivar require24_x7_response: Indicates if this requires a 24x7 response from Azure. - :vartype require24_x7_response: bool - :ivar advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support - ticket. Required. Known values are: "Yes" and "No". - :vartype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent - :ivar problem_scoping_questions: Problem scoping questions associated with the support ticket. - :vartype problem_scoping_questions: str - :ivar support_plan_id: Support plan id associated with the support ticket. - :vartype support_plan_id: str - :ivar contact_details: Contact information of the user requesting to create a support ticket. - Required. - :vartype contact_details: ~azure.mgmt.support.models.ContactProfile - :ivar service_level_agreement: Service Level Agreement information for this support ticket. - :vartype service_level_agreement: ~azure.mgmt.support.models.ServiceLevelAgreement - :ivar support_engineer: Information about the support engineer working on this support ticket. - :vartype support_engineer: ~azure.mgmt.support.models.SupportEngineer - :ivar support_plan_type: Support plan type associated with the support ticket. - :vartype support_plan_type: str - :ivar support_plan_display_name: Support plan type associated with the support ticket. - :vartype support_plan_display_name: str - :ivar title: Title of the support ticket. Required. - :vartype title: str - :ivar problem_start_time: Time in UTC (ISO 8601 format) when the problem started. - :vartype problem_start_time: ~datetime.datetime - :ivar service_id: This is the resource Id of the Azure service resource associated with the - support ticket. Required. - :vartype service_id: str - :ivar service_display_name: Localized name of the Azure service. - :vartype service_display_name: str - :ivar status: Status of the support ticket. - :vartype status: str - :ivar created_date: Time in UTC (ISO 8601 format) when the support ticket was created. - :vartype created_date: ~datetime.datetime - :ivar modified_date: Time in UTC (ISO 8601 format) when the support ticket was last modified. - :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 - :ivar quota_ticket_details: Additional ticket details associated with a quota support ticket - request. - :vartype quota_ticket_details: ~azure.mgmt.support.models.QuotaTicketDetails - :ivar secondary_consent: This property indicates secondary consents for the support ticket. - :vartype secondary_consent: list[~azure.mgmt.support.models.SecondaryConsent] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "description": {"required": True}, - "problem_classification_id": {"required": True}, - "problem_classification_display_name": {"readonly": True}, - "severity": {"required": True}, - "advanced_diagnostic_consent": {"required": True}, - "contact_details": {"required": True}, - "support_plan_type": {"readonly": True}, - "support_plan_display_name": {"readonly": True}, - "title": {"required": True}, - "service_id": {"required": True}, - "service_display_name": {"readonly": True}, - "status": {"readonly": True}, - "created_date": {"readonly": True}, - "modified_date": {"readonly": True}, - "is_temporary_ticket": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "support_ticket_id": {"key": "properties.supportTicketId", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "problem_classification_id": {"key": "properties.problemClassificationId", "type": "str"}, - "problem_classification_display_name": {"key": "properties.problemClassificationDisplayName", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "enrollment_id": {"key": "properties.enrollmentId", "type": "str"}, - "require24_x7_response": {"key": "properties.require24X7Response", "type": "bool"}, - "advanced_diagnostic_consent": {"key": "properties.advancedDiagnosticConsent", "type": "str"}, - "problem_scoping_questions": {"key": "properties.problemScopingQuestions", "type": "str"}, - "support_plan_id": {"key": "properties.supportPlanId", "type": "str"}, - "contact_details": {"key": "properties.contactDetails", "type": "ContactProfile"}, - "service_level_agreement": {"key": "properties.serviceLevelAgreement", "type": "ServiceLevelAgreement"}, - "support_engineer": {"key": "properties.supportEngineer", "type": "SupportEngineer"}, - "support_plan_type": {"key": "properties.supportPlanType", "type": "str"}, - "support_plan_display_name": {"key": "properties.supportPlanDisplayName", "type": "str"}, - "title": {"key": "properties.title", "type": "str"}, - "problem_start_time": {"key": "properties.problemStartTime", "type": "iso-8601"}, - "service_id": {"key": "properties.serviceId", "type": "str"}, - "service_display_name": {"key": "properties.serviceDisplayName", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "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]"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - description: str, - problem_classification_id: str, - severity: Union[str, "_models.SeverityLevel"], - advanced_diagnostic_consent: Union[str, "_models.Consent"], - contact_details: "_models.ContactProfile", - title: str, - service_id: str, - support_ticket_id: Optional[str] = None, - enrollment_id: Optional[str] = None, - require24_x7_response: Optional[bool] = None, - problem_scoping_questions: Optional[str] = None, - support_plan_id: Optional[str] = None, - service_level_agreement: Optional["_models.ServiceLevelAgreement"] = None, - support_engineer: Optional["_models.SupportEngineer"] = None, - problem_start_time: Optional[datetime.datetime] = None, - file_workspace_name: Optional[str] = None, - technical_ticket_details: Optional["_models.TechnicalTicketDetails"] = None, - quota_ticket_details: Optional["_models.QuotaTicketDetails"] = None, - secondary_consent: Optional[List["_models.SecondaryConsent"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword support_ticket_id: System generated support ticket Id that is unique. - :paramtype support_ticket_id: str - :keyword description: Detailed description of the question or issue. Required. - :paramtype description: str - :keyword problem_classification_id: Each Azure service has its own set of issue categories, - also known as problem classification. This parameter is the unique Id for the type of problem - you are experiencing. Required. - :paramtype problem_classification_id: str - :keyword severity: A value that indicates the urgency of the case, which in turn determines the - response time according to the service level agreement of the technical support plan you have - with Azure. Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' - level in the Azure portal is reserved only for our Premium customers. Required. Known values - are: "minimal", "moderate", "critical", and "highestcriticalimpact". - :paramtype severity: str or ~azure.mgmt.support.models.SeverityLevel - :keyword enrollment_id: Enrollment Id associated with the support ticket. - :paramtype enrollment_id: str - :keyword require24_x7_response: Indicates if this requires a 24x7 response from Azure. - :paramtype require24_x7_response: bool - :keyword advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support - ticket. Required. Known values are: "Yes" and "No". - :paramtype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent - :keyword problem_scoping_questions: Problem scoping questions associated with the support - ticket. - :paramtype problem_scoping_questions: str - :keyword support_plan_id: Support plan id associated with the support ticket. - :paramtype support_plan_id: str - :keyword contact_details: Contact information of the user requesting to create a support - ticket. Required. - :paramtype contact_details: ~azure.mgmt.support.models.ContactProfile - :keyword service_level_agreement: Service Level Agreement information for this support ticket. - :paramtype service_level_agreement: ~azure.mgmt.support.models.ServiceLevelAgreement - :keyword support_engineer: Information about the support engineer working on this support - ticket. - :paramtype support_engineer: ~azure.mgmt.support.models.SupportEngineer - :keyword title: Title of the support ticket. Required. - :paramtype title: str - :keyword problem_start_time: Time in UTC (ISO 8601 format) when the problem started. - :paramtype problem_start_time: ~datetime.datetime - :keyword service_id: This is the resource Id of the Azure service resource associated with the - support ticket. Required. - :paramtype service_id: str - :keyword file_workspace_name: File workspace name. - :paramtype file_workspace_name: str - :keyword technical_ticket_details: Additional ticket details associated with a technical - support ticket request. - :paramtype technical_ticket_details: ~azure.mgmt.support.models.TechnicalTicketDetails - :keyword quota_ticket_details: Additional ticket details associated with a quota support ticket - request. - :paramtype quota_ticket_details: ~azure.mgmt.support.models.QuotaTicketDetails - :keyword secondary_consent: This property indicates secondary consents for the support ticket. - :paramtype secondary_consent: list[~azure.mgmt.support.models.SecondaryConsent] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.support_ticket_id = support_ticket_id - self.description = description - self.problem_classification_id = problem_classification_id - self.problem_classification_display_name = None - self.severity = severity - 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 - self.support_plan_id = support_plan_id - self.contact_details = contact_details - self.service_level_agreement = service_level_agreement - self.support_engineer = support_engineer - self.support_plan_type = None - self.support_plan_display_name = None - self.title = title - self.problem_start_time = problem_start_time - self.service_id = service_id - self.service_display_name = None - self.status = None - self.created_date = None - self.modified_date = None - self.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 - - -class SupportTicketsListResult(_serialization.Model): - """Object that represents a collection of SupportTicket resources. - - :ivar value: List of SupportTicket resources. - :vartype value: list[~azure.mgmt.support.models.SupportTicketDetails] - :ivar next_link: The URI to fetch the next page of SupportTicket resources. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SupportTicketDetails]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.SupportTicketDetails"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: List of SupportTicket resources. - :paramtype value: list[~azure.mgmt.support.models.SupportTicketDetails] - :keyword next_link: The URI to fetch the next page of SupportTicket resources. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.support.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.support.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.support.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.support.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class TechnicalTicketDetails(_serialization.Model): - """Additional information for technical support ticket. - - :ivar resource_id: This is the resource Id of the Azure service resource (For example: A - virtual machine resource or an HDInsight resource) for which the support ticket is created. - :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: This is the resource Id of the Azure service resource (For example: A - virtual machine resource or an HDInsight resource) for which the support ticket is created. - :paramtype resource_id: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - - -class UpdateContactProfile(_serialization.Model): - """Contact information associated with the support ticket. - - :ivar first_name: First name. - :vartype first_name: str - :ivar last_name: Last name. - :vartype last_name: str - :ivar preferred_contact_method: Preferred contact method. Known values are: "email" and - "phone". - :vartype preferred_contact_method: str or ~azure.mgmt.support.models.PreferredContactMethod - :ivar primary_email_address: Primary email address. - :vartype primary_email_address: str - :ivar additional_email_addresses: Email addresses listed will be copied on any correspondence - about the support ticket. - :vartype additional_email_addresses: list[str] - :ivar phone_number: Phone number. This is required if preferred contact method is phone. - :vartype phone_number: str - :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from - `Microsoft Time Zone Index Values - `_. - :vartype preferred_time_zone: str - :ivar country: Country of the user. This is the ISO 3166-1 alpha-3 code. - :vartype country: str - :ivar preferred_support_language: Preferred language of support from Azure. Support languages - vary based on the severity you choose for your support ticket. Learn more at `Azure Severity - and responsiveness `_. Use the standard - language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for - Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, - 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. - :vartype preferred_support_language: str - """ - - _attribute_map = { - "first_name": {"key": "firstName", "type": "str"}, - "last_name": {"key": "lastName", "type": "str"}, - "preferred_contact_method": {"key": "preferredContactMethod", "type": "str"}, - "primary_email_address": {"key": "primaryEmailAddress", "type": "str"}, - "additional_email_addresses": {"key": "additionalEmailAddresses", "type": "[str]"}, - "phone_number": {"key": "phoneNumber", "type": "str"}, - "preferred_time_zone": {"key": "preferredTimeZone", "type": "str"}, - "country": {"key": "country", "type": "str"}, - "preferred_support_language": {"key": "preferredSupportLanguage", "type": "str"}, - } - - def __init__( - self, - *, - first_name: Optional[str] = None, - last_name: Optional[str] = None, - preferred_contact_method: Optional[Union[str, "_models.PreferredContactMethod"]] = None, - primary_email_address: Optional[str] = None, - additional_email_addresses: Optional[List[str]] = None, - phone_number: Optional[str] = None, - preferred_time_zone: Optional[str] = None, - country: Optional[str] = None, - preferred_support_language: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword first_name: First name. - :paramtype first_name: str - :keyword last_name: Last name. - :paramtype last_name: str - :keyword preferred_contact_method: Preferred contact method. Known values are: "email" and - "phone". - :paramtype preferred_contact_method: str or ~azure.mgmt.support.models.PreferredContactMethod - :keyword primary_email_address: Primary email address. - :paramtype primary_email_address: str - :keyword additional_email_addresses: Email addresses listed will be copied on any - correspondence about the support ticket. - :paramtype additional_email_addresses: list[str] - :keyword phone_number: Phone number. This is required if preferred contact method is phone. - :paramtype phone_number: str - :keyword preferred_time_zone: Time zone of the user. This is the name of the time zone from - `Microsoft Time Zone Index Values - `_. - :paramtype preferred_time_zone: str - :keyword country: Country of the user. This is the ISO 3166-1 alpha-3 code. - :paramtype country: str - :keyword preferred_support_language: Preferred language of support from Azure. Support - languages vary based on the severity you choose for your support ticket. Learn more at `Azure - Severity and responsiveness `_. Use the - standard language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, - 'es-es' for Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for - Russian, 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for - German. - :paramtype preferred_support_language: str - """ - super().__init__(**kwargs) - self.first_name = first_name - self.last_name = last_name - self.preferred_contact_method = preferred_contact_method - self.primary_email_address = primary_email_address - self.additional_email_addresses = additional_email_addresses - self.phone_number = phone_number - self.preferred_time_zone = preferred_time_zone - self.country = country - self.preferred_support_language = preferred_support_language - - -class UpdateSupportTicket(_serialization.Model): - """Updates severity, ticket status, contact details, advanced diagnostic consent and secondary - consent in the support ticket. - - :ivar severity: Severity level. Known values are: "minimal", "moderate", "critical", and - "highestcriticalimpact". - :vartype severity: str or ~azure.mgmt.support.models.SeverityLevel - :ivar status: Status to be updated on the ticket. Known values are: "open" and "closed". - :vartype status: str or ~azure.mgmt.support.models.Status - :ivar contact_details: Contact details to be updated on the support ticket. - :vartype contact_details: ~azure.mgmt.support.models.UpdateContactProfile - :ivar advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support - ticket. Known values are: "Yes" and "No". - :vartype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent - :ivar secondary_consent: This property indicates secondary consents for the support ticket. - :vartype secondary_consent: list[~azure.mgmt.support.models.SecondaryConsent] - """ - - _attribute_map = { - "severity": {"key": "severity", "type": "str"}, - "status": {"key": "status", "type": "str"}, - "contact_details": {"key": "contactDetails", "type": "UpdateContactProfile"}, - "advanced_diagnostic_consent": {"key": "advancedDiagnosticConsent", "type": "str"}, - "secondary_consent": {"key": "secondaryConsent", "type": "[SecondaryConsent]"}, - } - - def __init__( - self, - *, - severity: Optional[Union[str, "_models.SeverityLevel"]] = None, - status: Optional[Union[str, "_models.Status"]] = None, - contact_details: Optional["_models.UpdateContactProfile"] = None, - advanced_diagnostic_consent: Optional[Union[str, "_models.Consent"]] = None, - secondary_consent: Optional[List["_models.SecondaryConsent"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword severity: Severity level. Known values are: "minimal", "moderate", "critical", and - "highestcriticalimpact". - :paramtype severity: str or ~azure.mgmt.support.models.SeverityLevel - :keyword status: Status to be updated on the ticket. Known values are: "open" and "closed". - :paramtype status: str or ~azure.mgmt.support.models.Status - :keyword contact_details: Contact details to be updated on the support ticket. - :paramtype contact_details: ~azure.mgmt.support.models.UpdateContactProfile - :keyword advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support - ticket. Known values are: "Yes" and "No". - :paramtype advanced_diagnostic_consent: str or ~azure.mgmt.support.models.Consent - :keyword secondary_consent: This property indicates secondary consents for the support ticket. - :paramtype secondary_consent: list[~azure.mgmt.support.models.SecondaryConsent] - """ - super().__init__(**kwargs) - self.severity = severity - self.status = status - self.contact_details = contact_details - self.advanced_diagnostic_consent = advanced_diagnostic_consent - self.secondary_consent = secondary_consent - - -class UploadFile(_serialization.Model): - """File content associated with the file under a workspace. - - :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: int - """ - - _attribute_map = { - "content": {"key": "content", "type": "str"}, - "chunk_index": {"key": "chunkIndex", "type": "int"}, - } - - 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: int - """ - super().__init__(**kwargs) - self.content = content - self.chunk_index = chunk_index diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_patch.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_patch.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/models/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/__init__.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/__init__.py index 7700443bd45e..0a91122099dc 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 @@ -2,36 +2,50 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +# pylint: disable=wrong-import-position -from ._operations import Operations -from ._services_operations import ServicesOperations -from ._problem_classifications_operations import ProblemClassificationsOperations -from ._support_tickets_operations import SupportTicketsOperations -from ._support_tickets_no_subscription_operations import SupportTicketsNoSubscriptionOperations -from ._communications_operations import CommunicationsOperations -from ._communications_no_subscription_operations import CommunicationsNoSubscriptionOperations -from ._chat_transcripts_operations import ChatTranscriptsOperations -from ._chat_transcripts_no_subscription_operations import ChatTranscriptsNoSubscriptionOperations -from ._file_workspaces_operations import FileWorkspacesOperations -from ._file_workspaces_no_subscription_operations import FileWorkspacesNoSubscriptionOperations -from ._files_operations import FilesOperations -from ._files_no_subscription_operations import FilesNoSubscriptionOperations +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from ._patch import * # pylint: disable=unused-wildcard-import + +from ._operations import Operations # type: ignore +from ._operations import ServicesOperations # type: ignore +from ._operations import ClassifyServicesOperations # type: ignore +from ._operations import ClassifyServicesNoSubscriptionOperations # type: ignore +from ._operations import ClassifyProblemsOperations # type: ignore +from ._operations import ClassifyProblemsNoSubscriptionOperations # type: ignore +from ._operations import ProblemClassificationsOperations # type: ignore +from ._operations import CommunicationsOperations # type: ignore +from ._operations import SupportTicketsOperations # type: ignore +from ._operations import CommunicationsNoSubscriptionOperations # type: ignore +from ._operations import SupportTicketsNoSubscriptionOperations # type: ignore +from ._operations import ChatTranscriptsOperations # type: ignore +from ._operations import ChatTranscriptsNoSubscriptionOperations # type: ignore +from ._operations import FileWorkspacesOperations # type: ignore +from ._operations import FileWorkspacesNoSubscriptionOperations # type: ignore +from ._operations import FilesOperations # type: ignore +from ._operations import FilesNoSubscriptionOperations # type: ignore from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import +from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ "Operations", "ServicesOperations", + "ClassifyServicesOperations", + "ClassifyServicesNoSubscriptionOperations", + "ClassifyProblemsOperations", + "ClassifyProblemsNoSubscriptionOperations", "ProblemClassificationsOperations", - "SupportTicketsOperations", - "SupportTicketsNoSubscriptionOperations", "CommunicationsOperations", + "SupportTicketsOperations", "CommunicationsNoSubscriptionOperations", + "SupportTicketsNoSubscriptionOperations", "ChatTranscriptsOperations", "ChatTranscriptsNoSubscriptionOperations", "FileWorkspacesOperations", @@ -39,5 +53,5 @@ "FilesOperations", "FilesNoSubscriptionOperations", ] -__all__.extend([p for p in _patch_all if p not in __all__]) +__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_no_subscription_operations.py deleted file mode 100644 index c422366064be..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_no_subscription_operations.py +++ /dev/null @@ -1,243 +0,0 @@ -# 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 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", "2024-04-01")) - 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "chatTranscriptName": _SERIALIZER.url("chat_transcript_name", chat_transcript_name, "str"), - } - - _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 ChatTranscriptsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`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 - :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. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param chat_transcript_name: ChatTranscript name. Required. - :type chat_transcript_name: str - :return: ChatTranscriptDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - chat_transcript_name=chat_transcript_name, - api_version=api_version, - 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("ChatTranscriptDetails", 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/_chat_transcripts_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_operations.py deleted file mode 100644 index 1f47a12e2ffc..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_chat_transcripts_operations.py +++ /dev/null @@ -1,252 +0,0 @@ -# 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 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, 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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, 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "chatTranscriptName": _SERIALIZER.url("chat_transcript_name", chat_transcript_name, "str"), - "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 - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class ChatTranscriptsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`chat_transcripts` 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 under subscription. - - :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, - subscription_id=self._config.subscription_id, - 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 support ticket under a subscription. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param chat_transcript_name: ChatTranscript name. Required. - :type chat_transcript_name: str - :return: ChatTranscriptDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - chat_transcript_name=chat_transcript_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("ChatTranscriptDetails", 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/_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_no_subscription_operations.py deleted file mode 100644 index 1b9c73cd0c63..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_no_subscription_operations.py +++ /dev/null @@ -1,646 +0,0 @@ -# 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, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -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_check_name_availability_request(support_ticket_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - } - - _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( - 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", "2024-04-01")) - 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), - } - - _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_create_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", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), - } - - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class CommunicationsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`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") - - @overload - def check_name_availability( - self, - support_ticket_name: str, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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 adding a new communication to the support ticket. - - :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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_request( - support_ticket_name=support_ticket_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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - 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 - ) -> 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: - """Returns communication details for a support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :return: CommunicationDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CommunicationDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - api_version=api_version, - 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("CommunicationDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_communication_parameters, (IOBase, bytes)): - _content = create_communication_parameters - else: - _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - - _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, - 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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: _models.CommunicationDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :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 - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Is either a CommunicationDetails - 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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.CommunicationDetails] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - create_communication_parameters=create_communication_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_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[_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 deleted file mode 100644 index f6ddfe767097..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_communications_operations.py +++ /dev/null @@ -1,663 +0,0 @@ -# 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, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -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_check_name_availability_request(support_ticket_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", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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( - support_ticket_name: str, - subscription_id: 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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, 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), - "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 - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - support_ticket_name: str, communication_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", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "communicationName": _SERIALIZER.url("communication_name", communication_name, "str"), - "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class CommunicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`communications` 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 check_name_availability( - self, - support_ticket_name: str, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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 adding a new communication to the support ticket. - - :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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, - support_ticket_name: str, - 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 adding a new communication to the support ticket. - - :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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _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, - 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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - 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 - ) -> 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, - subscription_id=self._config.subscription_id, - 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: - """Returns communication details for a support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :return: CommunicationDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CommunicationDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("CommunicationDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.CommunicationDetails]: - 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[Optional[_models.CommunicationDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_communication_parameters, (IOBase, bytes)): - _content = create_communication_parameters - else: - _json = self._serialize.body(create_communication_parameters, "CommunicationDetails") - - _request = build_create_request( - support_ticket_name=support_ticket_name, - communication_name=communication_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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: _models.CommunicationDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Required. - :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 - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - support_ticket_name: str, - communication_name: str, - create_communication_parameters: Union[_models.CommunicationDetails, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CommunicationDetails]: - """Adds a new customer communication to an Azure support ticket. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param communication_name: Communication name. Required. - :type communication_name: str - :param create_communication_parameters: Communication object. Is either a CommunicationDetails - 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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.CommunicationDetails] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - support_ticket_name=support_ticket_name, - communication_name=communication_name, - create_communication_parameters=create_communication_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CommunicationDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_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[_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 deleted file mode 100644 index 081010141e51..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_no_subscription_operations.py +++ /dev/null @@ -1,208 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -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_get_request(file_workspace_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}") - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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_create_request(file_workspace_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}") - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url( - "file_workspace_name", file_workspace_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 - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class FileWorkspacesNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`file_workspaces_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 get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Gets details for a specific file workspace. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - api_version=api_version, - 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("FileWorkspaceDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Creates a new file workspace. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - api_version=api_version, - 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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileWorkspaceDetails", 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/_file_workspaces_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_operations.py deleted file mode 100644 index eb2e8bb39df3..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_file_workspaces_operations.py +++ /dev/null @@ -1,216 +0,0 @@ -# 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 typing import Any, Callable, Dict, Optional, TypeVar - -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_get_request(file_workspace_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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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_create_request(file_workspace_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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url( - "file_workspace_name", file_workspace_name, "str", pattern=r"^[0-9a-zA-Z_\-. ]+$" - ), - "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 - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class FileWorkspacesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`file_workspaces` 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 get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Gets details for a specific file workspace in an Azure subscription. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("FileWorkspaceDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: - """Creates a new file workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :return: FileWorkspaceDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileWorkspaceDetails", 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/_files_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_no_subscription_operations.py deleted file mode 100644 index 30f3b465c88e..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_no_subscription_operations.py +++ /dev/null @@ -1,552 +0,0 @@ -# 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, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -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(file_workspace_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files") - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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(file_workspace_name: str, file_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" - ) - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), - "fileName": _SERIALIZER.url("file_name", file_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_create_request(file_workspace_name: str, file_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" - ) - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url( - "file_workspace_name", file_workspace_name, "str", pattern=r"^[0-9a-zA-Z_\-. ]+$" - ), - "fileName": _SERIALIZER.url("file_name", file_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 - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_upload_request(file_workspace_name: str, file_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" - ) # pylint: disable=line-too-long - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), - "fileName": _SERIALIZER.url("file_name", file_name, "str"), - } - - _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 FilesNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`files_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, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.FileDetails"]: - """Lists all the Files information under a workspace for an Azure subscription. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :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: - """ - _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.FilesListResult] = 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( - file_workspace_name=file_workspace_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("FilesListResult", 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, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: - """Returns details of a specific file in a work space. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - file_name=file_name, - api_version=api_version, - 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("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: _models.FileDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :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 - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: Union[_models.FileDetails, IO[bytes]], - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace. - - :param file_workspace_name: File workspace name. Required. - :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[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: - """ - 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.FileDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_file_parameters, (IOBase, bytes)): - _content = create_file_parameters - else: - _json = self._serialize.body(create_file_parameters, "FileDetails") - - _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, - 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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: _models.UploadFile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def upload( # pylint: disable=inconsistent-return-statements - 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. - - :param file_workspace_name: File WorkspaceName. Required. - :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[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: - """ - 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[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(upload_file, (IOBase, bytes)): - _content = upload_file - else: - _json = self._serialize.body(upload_file, "UploadFile") - - _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, - 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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # 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 deleted file mode 100644 index 491f9497fe59..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_files_operations.py +++ /dev/null @@ -1,566 +0,0 @@ -# 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, Iterable, Optional, TypeVar, Union, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request - -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(file_workspace_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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files", - ) # pylint: disable=line-too-long - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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(file_workspace_name: str, file_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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), - "fileName": _SERIALIZER.url("file_name", file_name, "str"), - "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 - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request(file_workspace_name: str, file_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", "2024-04-01")) - 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/fileWorkspaces/{fileWorkspaceName}/files/{fileName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url( - "file_workspace_name", file_workspace_name, "str", pattern=r"^[0-9a-zA-Z_\-. ]+$" - ), - "fileName": _SERIALIZER.url("file_name", file_name, "str"), - "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_upload_request(file_workspace_name: str, file_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", "2024-04-01")) - 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/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload", - ) # pylint: disable=line-too-long - path_format_arguments = { - "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), - "fileName": _SERIALIZER.url("file_name", file_name, "str"), - "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 FilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`files` 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, file_workspace_name: str, **kwargs: Any) -> Iterable["_models.FileDetails"]: - """Lists all the Files information under a workspace for an Azure subscription. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :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: - """ - _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.FilesListResult] = 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( - file_workspace_name=file_workspace_name, - subscription_id=self._config.subscription_id, - 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("FilesListResult", 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, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: - """Returns details of a specific file in a work space. - - :param file_workspace_name: File Workspace Name. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - file_workspace_name=file_workspace_name, - file_name=file_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: _models.FileDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :type create_file_parameters: ~azure.mgmt.support.models.FileDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :type file_workspace_name: str - :param file_name: File name. Required. - :type file_name: str - :param create_file_parameters: Create file object. Required. - :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 - :return: FileDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.FileDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - file_workspace_name: str, - file_name: str, - create_file_parameters: Union[_models.FileDetails, IO[bytes]], - **kwargs: Any - ) -> _models.FileDetails: - """Creates a new file under a workspace for the specified subscription. - - :param file_workspace_name: File workspace name. Required. - :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[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: - """ - 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.FileDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_file_parameters, (IOBase, bytes)): - _content = create_file_parameters - else: - _json = self._serialize.body(create_file_parameters, "FileDetails") - - _request = build_create_request( - file_workspace_name=file_workspace_name, - file_name=file_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 [201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FileDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: _models.UploadFile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :type upload_file: ~azure.mgmt.support.models.UploadFile - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def upload( # pylint: disable=inconsistent-return-statements - self, - file_workspace_name: str, - file_name: str, - upload_file: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """This API allows you to upload content to a file. - - :param file_workspace_name: File WorkspaceName. Required. - :type file_workspace_name: str - :param file_name: File Name. Required. - :type file_name: str - :param upload_file: UploadFile object. Required. - :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 - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def upload( # pylint: disable=inconsistent-return-statements - 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. - - :param file_workspace_name: File WorkspaceName. Required. - :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[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: - """ - 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[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(upload_file, (IOBase, bytes)): - _content = upload_file - else: - _json = self._serialize.body(upload_file, "UploadFile") - - _request = build_upload_request( - file_workspace_name=file_workspace_name, - file_name=file_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 [204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_operations.py index 864083b878b6..20259b361371 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,50 +1,60 @@ -# pylint: disable=too-many-lines,too-many-statements +# pylint: disable=line-too-long,useless-suppression,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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload import urllib.parse +from azure.core import PipelineClient from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.rest import HttpRequest +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling -from .. import models as _models -from .._serialization import Serializer -from .._vendor import _convert_request +from .. import models as _models, types as _types +from .._configuration import SupportMgmtClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer +from .._validation import api_version_validation T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/operations") + _url = "/providers/Microsoft.Support/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,40 +65,6705 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_services_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/services/{serviceName}" + path_format_arguments = { + "serviceName": _SERIALIZER.url("service_name", service_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_services_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/services" + + # 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_classify_services_classify_services_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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) + + +def build_classify_services_no_subscription_classify_services_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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) + + +def build_classify_problems_classify_problems_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/services/{problemServiceName}/classifyProblems" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "problemServiceName": _SERIALIZER.url("problem_service_name", problem_service_name, "str"), + } + + _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_classify_problems_no_subscription_classify_problems_request( # pylint: disable=name-too-long + problem_service_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/services/{problemServiceName}/classifyProblems" + path_format_arguments = { + "problemServiceName": _SERIALIZER.url("problem_service_name", problem_service_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 + 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_problem_classifications_get_request( # pylint: disable=name-too-long + service_name: str, problem_classification_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}" + path_format_arguments = { + "serviceName": _SERIALIZER.url("service_name", service_name, "str"), + "problemClassificationName": _SERIALIZER.url("problem_classification_name", problem_classification_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_problem_classifications_list_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/services/{serviceName}/problemClassifications" + path_format_arguments = { + "serviceName": _SERIALIZER.url("service_name", service_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_communications_get_request( + support_ticket_name: str, communication_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + "communicationName": _SERIALIZER.url("communication_name", communication_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_communications_create_request( + support_ticket_name: str, communication_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + "communicationName": _SERIALIZER.url("communication_name", communication_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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_communications_list_request( + support_ticket_name: str, + subscription_id: 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_communications_check_name_availability_request( # pylint: disable=name-too-long + support_ticket_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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 + 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_support_tickets_get_request(support_ticket_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_support_tickets_create_request(support_ticket_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_support_tickets_update_request(support_ticket_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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 + 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_support_tickets_list_request( + subscription_id: 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets" + 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") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_support_tickets_look_up_resource_id_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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) + + +def build_support_tickets_check_name_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/checkNameAvailability" + 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) + + +def build_communications_no_subscription_get_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" + path_format_arguments = { + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + "communicationName": _SERIALIZER.url("communication_name", communication_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_communications_no_subscription_create_request( # pylint: disable=name-too-long + 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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets/{supportTicketName}/communications/{communicationName}" + path_format_arguments = { + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + "communicationName": _SERIALIZER.url("communication_name", communication_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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_communications_no_subscription_list_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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 + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_communications_no_subscription_check_name_availability_request( # pylint: disable=name-too-long + support_ticket_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets/{supportTicketName}/checkNameAvailability" + 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 + 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_support_tickets_no_subscription_get_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets/{supportTicketName}" + 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_support_tickets_no_subscription_create_request( # pylint: disable=name-too-long + support_ticket_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets/{supportTicketName}" + 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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_support_tickets_no_subscription_update_request( # pylint: disable=name-too-long + support_ticket_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets/{supportTicketName}" + 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 + 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_support_tickets_no_subscription_list_request( # pylint: disable=name-too-long + *, 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if top is not None: + _params["$top"] = _SERIALIZER.query("top", top, "int") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_support_tickets_no_subscription_check_name_availability_request( # pylint: disable=name-too-long + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/checkNameAvailability" + + # 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_chat_transcripts_get_request( + support_ticket_name: str, chat_transcript_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + "chatTranscriptName": _SERIALIZER.url("chat_transcript_name", chat_transcript_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_chat_transcripts_list_request(support_ticket_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_chat_transcripts_no_subscription_get_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/supportTickets/{supportTicketName}/chatTranscripts/{chatTranscriptName}" + path_format_arguments = { + "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), + "chatTranscriptName": _SERIALIZER.url("chat_transcript_name", chat_transcript_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_chat_transcripts_no_subscription_list_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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_file_workspaces_get_request(file_workspace_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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_file_workspaces_create_request(file_workspace_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_file_workspaces_no_subscription_get_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + path_format_arguments = { + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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_file_workspaces_no_subscription_create_request( # pylint: disable=name-too-long + 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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}" + path_format_arguments = { + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_files_get_request( + file_workspace_name: str, file_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), + "fileName": _SERIALIZER.url("file_name", file_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_files_create_request( + file_workspace_name: str, file_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), + "fileName": _SERIALIZER.url("file_name", file_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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_files_list_request(file_workspace_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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_files_upload_request( + file_workspace_name: str, file_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), + "fileName": _SERIALIZER.url("file_name", file_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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_files_no_subscription_get_request(file_workspace_name: str, file_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + path_format_arguments = { + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), + "fileName": _SERIALIZER.url("file_name", file_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_files_no_subscription_create_request( # pylint: disable=name-too-long + file_workspace_name: str, file_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}" + path_format_arguments = { + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), + "fileName": _SERIALIZER.url("file_name", file_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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_files_no_subscription_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", "2026-07-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files" + path_format_arguments = { + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_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_files_no_subscription_upload_request( # pylint: disable=name-too-long + file_workspace_name: str, file_name: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2026-07-01")) + # Construct URL + _url = "/providers/Microsoft.Support/fileWorkspaces/{fileWorkspaceName}/files/{fileName}/upload" + path_format_arguments = { + "fileWorkspaceName": _SERIALIZER.url("file_workspace_name", file_workspace_name, "str"), + "fileName": _SERIALIZER.url("file_name", file_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 + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`operations` attribute. + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Operation], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, 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. + :type service_name: str + :return: Service. The Service is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.Service + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Service] = kwargs.pop("cls", None) + + _request = build_services_get_request( + service_name=service_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Service, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Service"]: + """Lists all the Azure services available for support ticket creation. For **Technical** issues, + select the Service Id that maps to the Azure service/product as displayed in the **Services** + drop-down list on the Azure portal's `New support request + `_ page. + Always use the service and its corresponding problem classification(s) obtained + programmatically for support ticket creation. This practice ensures that you always have the + most recent set of service and problem classification Ids. + + :return: An iterator like instance of Service + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.Service] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Service]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_services_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.Service], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ClassifyServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`classify_services` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_services( + self, + service_classification_request: _types.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.types.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. The ServiceClassificationOutput is compatible with + MutableMapping + :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. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "subscription_id", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + def classify_services( + self, + service_classification_request: Union[ + _models.ServiceClassificationRequest, _types.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 ~azure.mgmt.support.types.ServiceClassificationRequest or IO[bytes] + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _content = json.dumps(service_classification_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_services_classify_services_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServiceClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ClassifyServicesNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`classify_services_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_services( + self, + service_classification_request: _models.ServiceClassificationRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ServiceClassificationOutput: + """Classify the list of right Azure services. + + :param service_classification_request: Input to check. Required. + :type service_classification_request: ~azure.mgmt.support.models.ServiceClassificationRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_services( + self, + service_classification_request: _types.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.types.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. The ServiceClassificationOutput is compatible with + MutableMapping + :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. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + def classify_services( + self, + service_classification_request: Union[ + _models.ServiceClassificationRequest, _types.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 ~azure.mgmt.support.types.ServiceClassificationRequest or IO[bytes] + :return: ServiceClassificationOutput. The ServiceClassificationOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.ServiceClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(service_classification_request, (IOBase, bytes)): + _content = service_classification_request + else: + _content = json.dumps(service_classification_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_services_no_subscription_classify_services_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ServiceClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ClassifyProblemsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`classify_problems` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _types.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.types.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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={ + "2026-06-01": ["api_version", "subscription_id", "problem_service_name", "content_type", "accept"] + }, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, + _types.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 + ~azure.mgmt.support.types.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _content = json.dumps(problem_classifications_classification_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_problems_classify_problems_request( + problem_service_name=problem_service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProblemClassificationsClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ClassifyProblemsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`classify_problems_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _models.ProblemClassificationsClassificationInput, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.ProblemClassificationsClassificationOutput: + """Classify the right problem classifications (categories) available for a specific Azure service. + + :param problem_service_name: Name of the Azure service for which the problem classifications + need to be retrieved. Required. + :type problem_service_name: str + :param problem_classifications_classification_input: Input to check. Required. + :type problem_classifications_classification_input: + ~azure.mgmt.support.models.ProblemClassificationsClassificationInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: _types.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.types.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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :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. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "problem_service_name", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + def classify_problems( + self, + problem_service_name: str, + problem_classifications_classification_input: Union[ + _models.ProblemClassificationsClassificationInput, + _types.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 + ~azure.mgmt.support.types.ProblemClassificationsClassificationInput or IO[bytes] + :return: ProblemClassificationsClassificationOutput. The + ProblemClassificationsClassificationOutput is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassificationsClassificationOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(problem_classifications_classification_input, (IOBase, bytes)): + _content = problem_classifications_classification_input + else: + _content = json.dumps(problem_classifications_classification_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_classify_problems_no_subscription_classify_problems_request( + problem_service_name=problem_service_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProblemClassificationsClassificationOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ProblemClassificationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`problem_classifications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, 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. Required. + :type service_name: str + :param problem_classification_name: Name of problem classification. Required. + :type problem_classification_name: str + :return: ProblemClassification. The ProblemClassification is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ProblemClassification + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ProblemClassification] = kwargs.pop("cls", None) + + _request = build_problem_classifications_get_request( + service_name=service_name, + problem_classification_name=problem_classification_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ProblemClassification, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, service_name: str, **kwargs: Any) -> ItemPaged["_models.ProblemClassification"]: + """Lists all the problem classifications (categories) available for a specific Azure service. + Always use the service and problem classifications obtained programmatically. This practice + ensures that you always have the most recent set of service and problem classification Ids. + + :param service_name: Name of the Azure service. Required. + :type service_name: str + :return: An iterator like instance of ProblemClassification + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ProblemClassification] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ProblemClassification]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_problem_classifications_list_request( + service_name=service_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ProblemClassification], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CommunicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`communications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) -> _models.CommunicationDetails: + """Returns communication details for a support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :return: CommunicationDetails. The CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.CommunicationDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + + _request = build_communications_get_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any, + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_communication_parameters, (IOBase, bytes)): + _content = create_communication_parameters + else: + _content = json.dumps(create_communication_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_create_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _models.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _types.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.types.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :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 + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Is either a CommunicationDetails + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + ~azure.mgmt.support.types.CommunicationDetails or IO[bytes] + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + create_communication_parameters=create_communication_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_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[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, support_ticket_name: str, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.CommunicationDetails"]: + """Lists all communications (attachments not included) for a support ticket.

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.

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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :keyword top: The number of values to return in the collection. Default is 10 and max is 10. + Default value is None. + :paramtype top: int + :keyword 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. + :paramtype filter: str + :return: An iterator like instance of CommunicationDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunicationDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_communications_list_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommunicationDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + support_ticket_name: str, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_check_name_availability_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SupportTicketsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`support_tickets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: + """Get ticket details for an Azure subscription. 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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + _request = build_support_tickets_get_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any, + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_support_ticket_parameters, (IOBase, bytes)): + _content = create_support_ticket_parameters + else: + _content = json.dumps(create_support_ticket_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_create_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _models.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _types.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.types.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :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 + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, + and Subscription Management issues for the specified subscription. Learn the `prerequisites + `_ required to create a support ticket.

Always call the + Services and ProblemClassifications API to get the most recent set of services and problem + categories required for support ticket creation.

Adding attachments is not currently + supported via the API. To add a file to an existing support ticket, visit the `Manage support + ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

**Creating a support ticket for on-behalf-of**: Include + *x-ms-authorization-auxiliary* header to provide an auxiliary token as per `documentation + `_. + The primary token will be from the tenant for whom a support ticket is being raised against the + subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be + from the Cloud solution provider (CSP) partner tenant. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Is either a + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + ~azure.mgmt.support.types.SupportTicketDetails or IO[bytes] + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + support_ticket_name=support_ticket_name, + create_support_ticket_parameters=create_support_ticket_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_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[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: _models.UpdateSupportTicket, + *, + content_type: str = "application/json", + **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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: _types.UpdateSupportTicket, + *, + content_type: str = "application/json", + **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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.types.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :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 + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, _types.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.

Note: The severity levels cannot + be changed if a support ticket is actively being worked upon by an Azure support engineer. In + such a case, contact your support engineer to request severity update by adding a new + communication using the Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or + ~azure.mgmt.support.types.UpdateSupportTicket or IO[bytes] + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(update_support_ticket, (IOBase, bytes)): + _content = update_support_ticket + else: + _content = json.dumps(update_support_ticket, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_update_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.SupportTicketDetails"]: + """Lists all the support tickets for an Azure subscription. You can also filter the support + tickets by *Status*, *CreatedDate*, *ServiceId*, and *ProblemClassificationId* using the + $filter parameter. Output will be a paged result with *nextLink*, using which you can retrieve + the next set of support tickets.

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. + + :keyword top: The number of values to return in the collection. Default is 25 and max is 100. + Default value is None. + :paramtype top: int + :keyword filter: The filter to apply on the operation. We support 'odata v4.0' filter + semantics. `Learn more `_. + *Status*, *ServiceId*, and *ProblemClassificationId* filters can only be used with Equals + ('eq') operator. For *CreatedDate* filter, the supported operators are Greater Than ('gt') and + Greater Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. + Default value is None. + :paramtype filter: str + :return: An iterator like instance of SupportTicketDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_support_tickets_list_request( + subscription_id=self._config.subscription_id, + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SupportTicketDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def look_up_resource_id( + 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. + + :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. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def look_up_resource_id( + self, + look_up_resource_id_request: _types.LookUpResourceIdRequest, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.LookUpResourceIdResponse: + """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.types.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. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def look_up_resource_id( + 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. + + :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. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + @api_version_validation( + method_added_on="2026-06-01", + params_added_on={"2026-06-01": ["api_version", "content_type", "accept"]}, + api_versions_list=["2026-06-01", "2026-07-01"], + ) + def look_up_resource_id( + self, + look_up_resource_id_request: Union[_models.LookUpResourceIdRequest, _types.LookUpResourceIdRequest, IO[bytes]], + **kwargs: Any, + ) -> _models.LookUpResourceIdResponse: + """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 + ~azure.mgmt.support.types.LookUpResourceIdRequest or IO[bytes] + :return: LookUpResourceIdResponse. The LookUpResourceIdResponse is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.LookUpResourceIdResponse + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(look_up_resource_id_request, (IOBase, bytes)): + _content = look_up_resource_id_request + else: + _content = json.dumps(look_up_resource_id_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_look_up_resource_id_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LookUpResourceIdResponse, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def check_name_availability( + self, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + 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: The request body. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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: The request body. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class CommunicationsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`communications_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, support_ticket_name: str, communication_name: str, **kwargs: Any) -> _models.CommunicationDetails: + """Returns communication details for a support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :return: CommunicationDetails. The CommunicationDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.CommunicationDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + + _request = build_communications_no_subscription_get_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any, + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_communication_parameters, (IOBase, bytes)): + _content = create_communication_parameters + else: + _content = json.dumps(create_communication_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_no_subscription_create_request( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _models.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: _types.CommunicationDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :type create_communication_parameters: ~azure.mgmt.support.types.CommunicationDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Required. + :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 + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + support_ticket_name: str, + communication_name: str, + create_communication_parameters: Union[_models.CommunicationDetails, _types.CommunicationDetails, IO[bytes]], + **kwargs: Any, + ) -> LROPoller[_models.CommunicationDetails]: + """Adds a new customer communication to an Azure support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param communication_name: The name of the CommunicationDetails. Required. + :type communication_name: str + :param create_communication_parameters: Communication object. Is either a CommunicationDetails + type or a IO[bytes] type. Required. + :type create_communication_parameters: ~azure.mgmt.support.models.CommunicationDetails or + ~azure.mgmt.support.types.CommunicationDetails or IO[bytes] + :return: An instance of LROPoller that returns CommunicationDetails. The CommunicationDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CommunicationDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + support_ticket_name=support_ticket_name, + communication_name=communication_name, + create_communication_parameters=create_communication_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CommunicationDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_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[_models.CommunicationDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list( + self, support_ticket_name: str, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.CommunicationDetails"]: + """Lists all communications (attachments not included) for a support ticket.

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.

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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :keyword top: The number of values to return in the collection. Default is 10 and max is 10. + Default value is None. + :paramtype top: int + :keyword 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. + :paramtype filter: str + :return: An iterator like instance of CommunicationDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.CommunicationDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CommunicationDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_communications_no_subscription_list_request( + support_ticket_name=support_ticket_name, + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.CommunicationDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + support_ticket_name: str, + 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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + support_ticket_name: str, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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 adding a new communication to the support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param check_name_availability_input: Input to check. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_communications_no_subscription_check_name_availability_request( + support_ticket_name=support_ticket_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class SupportTicketsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`support_tickets_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, support_ticket_name: str, **kwargs: Any) -> _models.SupportTicketDetails: + """Gets details for a specific support ticket. 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: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + _request = build_support_tickets_no_subscription_get_request( + support_ticket_name=support_ticket_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any, + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_support_ticket_parameters, (IOBase, bytes)): + _content = create_support_ticket_parameters + else: + _content = json.dumps(create_support_ticket_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_no_subscription_create_request( + support_ticket_name=support_ticket_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = True + 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, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _models.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: _types.SupportTicketDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.types.SupportTicketDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Required. + :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 + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + support_ticket_name: str, + create_support_ticket_parameters: Union[_models.SupportTicketDetails, _types.SupportTicketDetails, IO[bytes]], + **kwargs: Any, + ) -> LROPoller[_models.SupportTicketDetails]: + """Creates a new support ticket for Billing, and Subscription Management issues. Learn the + `prerequisites `_ required to create a support + ticket.

Always call the Services and ProblemClassifications API to get the most recent + set of services and problem categories required for support ticket creation.

Adding + attachments is not currently supported via the API. To add a file to an existing support + ticket, visit the `Manage support ticket + `_ + page in the Azure portal, select the support ticket, and use the file upload control to add a + new file.

Providing consent to share diagnostic information with Azure support is + currently not supported via the API. The Azure support engineer working on your ticket will + reach out to you for consent if your issue requires gathering diagnostic information from your + Azure resources.

. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param create_support_ticket_parameters: Support ticket request payload. Is either a + SupportTicketDetails type or a IO[bytes] type. Required. + :type create_support_ticket_parameters: ~azure.mgmt.support.models.SupportTicketDetails or + ~azure.mgmt.support.types.SupportTicketDetails or IO[bytes] + :return: An instance of LROPoller that returns SupportTicketDetails. The SupportTicketDetails + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + support_ticket_name=support_ticket_name, + create_support_ticket_parameters=create_support_ticket_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs, + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_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[_models.SupportTicketDetails]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: _models.UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.SupportTicketDetails: + """This API allows you to update the severity level, ticket status, and your contact information + in the support ticket.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: _types.UpdateSupportTicket, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.SupportTicketDetails: + """This API allows you to update the severity level, ticket status, and your contact information + in the support ticket.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :type update_support_ticket: ~azure.mgmt.support.types.UpdateSupportTicket + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + support_ticket_name: str, + update_support_ticket: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.SupportTicketDetails: + """This API allows you to update the severity level, ticket status, and your contact information + in the support ticket.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Required. + :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 + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + support_ticket_name: str, + update_support_ticket: Union[_models.UpdateSupportTicket, _types.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.

Note: The severity levels cannot be changed if a support ticket + is actively being worked upon by an Azure support engineer. In such a case, contact your + support engineer to request severity update by adding a new communication using the + Communications API. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type + or a IO[bytes] type. Required. + :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket or + ~azure.mgmt.support.types.UpdateSupportTicket or IO[bytes] + :return: SupportTicketDetails. The SupportTicketDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.SupportTicketDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SupportTicketDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(update_support_ticket, (IOBase, bytes)): + _content = update_support_ticket + else: + _content = json.dumps(update_support_ticket, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_no_subscription_update_request( + support_ticket_name=support_ticket_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.SupportTicketDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, *, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.SupportTicketDetails"]: + """Lists all the support tickets.

You can also filter the support tickets by + Status, CreatedDate, , ServiceId, and ProblemClassificationId using + the $filter parameter. Output will be a paged result with nextLink, using which you can + retrieve the next set of support tickets.

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. + + :keyword top: The number of values to return in the collection. Default is 25 and max is 100. + Default value is None. + :paramtype top: int + :keyword filter: The filter to apply on the operation. We support 'odata v4.0' filter + semantics. Learn more +
Status , ServiceId, and ProblemClassificationId filters can only be + used with 'eq' operator. For CreatedDate filter, the supported operators are 'gt' and + 'ge'. When using both filters, combine them using the logical 'AND'. Default value is None. + :paramtype filter: str + :return: An iterator like instance of SupportTicketDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.SupportTicketDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.SupportTicketDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_support_tickets_no_subscription_list_request( + top=top, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.SupportTicketDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def check_name_availability( + self, + check_name_availability_input: _models.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, + check_name_availability_input: _types.CheckNameAvailabilityInput, + *, + 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: The request body. Required. + :type check_name_availability_input: ~azure.mgmt.support.types.CheckNameAvailabilityInput + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + 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: The request body. Required. + :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 + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, + check_name_availability_input: Union[ + _models.CheckNameAvailabilityInput, _types.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: The request body. Is either a CheckNameAvailabilityInput + type or a IO[bytes] type. Required. + :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or + ~azure.mgmt.support.types.CheckNameAvailabilityInput or IO[bytes] + :return: CheckNameAvailabilityOutput. The CheckNameAvailabilityOutput is compatible with + MutableMapping + :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(check_name_availability_input, (IOBase, bytes)): + _content = check_name_availability_input + else: + _content = json.dumps(check_name_availability_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_support_tickets_no_subscription_check_name_availability_request( + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.CheckNameAvailabilityOutput, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ChatTranscriptsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`chat_transcripts` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any) -> _models.ChatTranscriptDetails: + """Returns chatTranscript details for a support ticket under a subscription. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param chat_transcript_name: The name of the ChatTranscriptDetails. Required. + :type chat_transcript_name: str + :return: ChatTranscriptDetails. The ChatTranscriptDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) + + _request = build_chat_transcripts_get_request( + support_ticket_name=support_ticket_name, + chat_transcript_name=chat_transcript_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ChatTranscriptDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, support_ticket_name: str, **kwargs: Any) -> ItemPaged["_models.ChatTranscriptDetails"]: + """Lists all chat transcripts for a support ticket under subscription. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: An iterator like instance of ChatTranscriptDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ChatTranscriptDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_chat_transcripts_list_request( + support_ticket_name=support_ticket_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ChatTranscriptDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ChatTranscriptsNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`chat_transcripts_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, support_ticket_name: str, chat_transcript_name: str, **kwargs: Any) -> _models.ChatTranscriptDetails: + """Returns chatTranscript details for a no subscription support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :param chat_transcript_name: The name of the ChatTranscriptDetails. Required. + :type chat_transcript_name: str + :return: ChatTranscriptDetails. The ChatTranscriptDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.ChatTranscriptDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ChatTranscriptDetails] = kwargs.pop("cls", None) + + _request = build_chat_transcripts_no_subscription_get_request( + support_ticket_name=support_ticket_name, + chat_transcript_name=chat_transcript_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ChatTranscriptDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, support_ticket_name: str, **kwargs: Any) -> ItemPaged["_models.ChatTranscriptDetails"]: + """Lists all chat transcripts for a support ticket. + + :param support_ticket_name: The name of the SupportTicketDetails. Required. + :type support_ticket_name: str + :return: An iterator like instance of ChatTranscriptDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ChatTranscriptDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ChatTranscriptDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_chat_transcripts_no_subscription_list_request( + support_ticket_name=support_ticket_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.ChatTranscriptDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class FileWorkspacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`file_workspaces` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Gets details for a specific file workspace in an Azure subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_get_request( + file_workspace_name=file_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Creates a new file workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_create_request( + file_workspace_name=file_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FileWorkspacesNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`file_workspaces_no_subscription` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Gets details for a specific file workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_no_subscription_get_request( + file_workspace_name=file_workspace_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def create(self, file_workspace_name: str, **kwargs: Any) -> _models.FileWorkspaceDetails: + """Creates a new file workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: FileWorkspaceDetails. The FileWorkspaceDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileWorkspaceDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileWorkspaceDetails] = kwargs.pop("cls", None) + + _request = build_file_workspaces_no_subscription_create_request( + file_workspace_name=file_workspace_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileWorkspaceDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class FilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`files` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: + """Returns details of a specific file in a work space. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + _request = build_files_get_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _models.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _types.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.types.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :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 + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: Union[_models.FileDetails, _types.FileDetails, IO[bytes]], + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace for the specified subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.FileDetails or IO[bytes] + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_file_parameters, (IOBase, bytes)): + _content = create_file_parameters + else: + _content = json.dumps(create_file_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_create_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, file_workspace_name: str, **kwargs: Any) -> ItemPaged["_models.FileDetails"]: + """Lists all the Files information under a workspace for an Azure subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: An iterator like instance of FileDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.FileDetails] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FileDetails]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 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_files_list_request( + file_workspace_name=file_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + 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), + headers=_headers, + params=_next_request_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.FileDetails], + deserialized.get("value", []), + ) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _models.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _types.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.types.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :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 + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def upload( # pylint: disable=inconsistent-return-statements + self, + file_workspace_name: str, + file_name: str, + upload_file: Union[_models.UploadFile, _types.UploadFile, IO[bytes]], + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.UploadFile or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(upload_file, (IOBase, bytes)): + _content = upload_file + else: + _content = json.dumps(upload_file, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_upload_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class FilesNoSubscriptionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.support.SupportMgmtClient`'s + :attr:`files_no_subscription` attribute. """ - models = _models - - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: SupportMgmtClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """This lists all the available Microsoft Support REST API operations. + def get(self, file_workspace_name: str, file_name: str, **kwargs: Any) -> _models.FileDetails: + """Returns details of a specific file in a work space. - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.Operation] + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + _request = build_files_no_subscription_get_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _models.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.models.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: _types.FileDetails, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :type create_file_parameters: ~azure.mgmt.support.types.FileDetails + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param create_file_parameters: Create file object. Required. + :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 + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create( + self, + file_workspace_name: str, + file_name: str, + create_file_parameters: Union[_models.FileDetails, _types.FileDetails, IO[bytes]], + **kwargs: Any, + ) -> _models.FileDetails: + """Creates a new file under a workspace. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.FileDetails or IO[bytes] + :return: FileDetails. The FileDetails is compatible with MutableMapping + :rtype: ~azure.mgmt.support.models.FileDetails + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.FileDetails] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(create_file_parameters, (IOBase, bytes)): + _content = create_file_parameters + else: + _content = json.dumps(create_file_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_no_subscription_create_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _decompress = kwargs.pop("decompress", True) + _stream = kwargs.pop("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 [201]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.FileDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, file_workspace_name: str, **kwargs: Any) -> ItemPaged["_models.FileDetails"]: + """Lists all the Files information under a workspace for an Azure subscription. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :return: An iterator like instance of FileDetails + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.FileDetails] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.OperationsListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.FileDetails]] = kwargs.pop("cls", None) - error_map = { + error_map: MutableMapping = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, @@ -99,13 +6774,18 @@ def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_files_no_subscription_list_request( + file_workspace_name=file_workspace_name, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: # make call to next link with the client's api-version @@ -118,19 +6798,29 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request = _convert_request(_request) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationsListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize( + List[_models.FileDetails], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -143,9 +6833,165 @@ def get_next(next_link=None): 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) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _models.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.models.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: _types.UploadFile, + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :type upload_file: ~azure.mgmt.support.types.UploadFile + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def upload( + self, + file_workspace_name: str, + file_name: str, + upload_file: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :param upload_file: UploadFile object. Required. + :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 + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def upload( # pylint: disable=inconsistent-return-statements + self, + file_workspace_name: str, + file_name: str, + upload_file: Union[_models.UploadFile, _types.UploadFile, IO[bytes]], + **kwargs: Any, + ) -> None: + """This API allows you to upload content to a file. + + :param file_workspace_name: The name of the FileWorkspaceDetails. Required. + :type file_workspace_name: str + :param file_name: The name of the FileDetails. Required. + :type file_name: str + :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 + ~azure.mgmt.support.types.UploadFile or IO[bytes] + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(upload_file, (IOBase, bytes)): + _content = upload_file + else: + _content = json.dumps(upload_file, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_files_no_subscription_upload_request( + file_workspace_name=file_workspace_name, + file_name=file_name, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_patch.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_patch.py index f7dd32510333..87676c65a8f0 100644 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_patch.py +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_patch.py @@ -1,14 +1,15 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): 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 deleted file mode 100644 index d161a05a612d..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_problem_classifications_operations.py +++ /dev/null @@ -1,246 +0,0 @@ -# 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 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(service_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/services/{serviceName}/problemClassifications") - path_format_arguments = { - "serviceName": _SERIALIZER.url("service_name", service_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(service_name: str, problem_classification_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.Support/services/{serviceName}/problemClassifications/{problemClassificationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "serviceName": _SERIALIZER.url("service_name", service_name, "str"), - "problemClassificationName": _SERIALIZER.url("problem_classification_name", problem_classification_name, "str"), - } - - _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 ProblemClassificationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`problem_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") - - @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. - Always use the service and problem classifications obtained programmatically. This practice - ensures that you always have the most recent set of service and problem classification Ids. - - :param service_name: Name of the Azure service for which the problem classifications need to be - retrieved. Required. - :type service_name: str - :return: An iterator like instance of either ProblemClassification or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.ProblemClassification] - :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.ProblemClassificationsListResult] = 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( - service_name=service_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("ProblemClassificationsListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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, 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. - :type service_name: str - :param problem_classification_name: Name of problem classification. Required. - :type problem_classification_name: str - :return: ProblemClassification or the result of cls(response) - :rtype: ~azure.mgmt.support.models.ProblemClassification - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - service_name=service_name, - problem_classification_name=problem_classification_name, - api_version=api_version, - 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("ProblemClassification", 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 deleted file mode 100644 index c1d983161a37..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_services_operations.py +++ /dev/null @@ -1,233 +0,0 @@ -# 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 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(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/services") - - # 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(service_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/services/{serviceName}") - path_format_arguments = { - "serviceName": _SERIALIZER.url("service_name", service_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 ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`services` 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, **kwargs: Any) -> Iterable["_models.Service"]: - """Lists all the Azure services available for support ticket creation. For **Technical** issues, - select the Service Id that maps to the Azure service/product as displayed in the **Services** - drop-down list on the Azure portal's `New support request - `_ page. - Always use the service and its corresponding problem classification(s) obtained - programmatically for support ticket creation. This practice ensures that you always have the - most recent set of service and problem classification Ids. - - :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: - """ - _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.ServicesListResult] = 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( - 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("ServicesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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, 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. - :type service_name: str - :return: Service or the result of cls(response) - :rtype: ~azure.mgmt.support.models.Service - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - service_name=service_name, - api_version=api_version, - 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("Service", 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/_support_tickets_no_subscription_operations.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_no_subscription_operations.py deleted file mode 100644 index f69e8ea51c78..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_no_subscription_operations.py +++ /dev/null @@ -1,784 +0,0 @@ -# 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, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -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_check_name_availability_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - 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/checkNameAvailability") - - # 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(*, 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets") - - # 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, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}") - 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_update_request(support_ticket_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}") - 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 - 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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request(support_ticket_name: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Support/supportTickets/{supportTicketName}") - 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 - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class SupportTicketsNoSubscriptionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`support_tickets_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 check_name_availability( - self, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - 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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - 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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.SupportTicketDetails"]: - """Lists all the support tickets. :code:`
`:code:`
`You can also filter the support - tickets by :code:`Status`, :code:`CreatedDate`, , :code:`ServiceId`, and - :code:`ProblemClassificationId` using the $filter parameter. Output will be a paged - result with :code:`nextLink`, using which you can retrieve the next set of support - tickets. :code:`
`:code:`
`Support ticket data is available for 18 months after ticket - creation. If a ticket was created more than 18 months ago, a request for data might cause an - error. - - :param top: The number of values to return in the collection. Default is 25 and max is 100. - Default value is None. - :type top: int - :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. - :code:`Learn more` - :code:`
`:code:`Status` , :code:`ServiceId`, and - :code:`ProblemClassificationId` filters can only be used with 'eq' operator. For - :code:`CreatedDate` filter, the supported operators are 'gt' and 'ge'. When using both - filters, combine them using the logical 'AND'. Default value is None. - :type filter: str - :return: An iterator like instance of either SupportTicketDetails or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.SupportTicketDetails] - :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.SupportTicketsListResult] = 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( - 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("SupportTicketsListResult", 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, **kwargs: Any) -> _models.SupportTicketDetails: - """Gets details for a specific support ticket. 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 - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - 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) - - _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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - support_ticket_name: str, - update_support_ticket: _models.UpdateSupportTicket, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - support_ticket_name: str, - update_support_ticket: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, and your contact information - in the support ticket.:code:`
`:code:`
`Note: The severity levels cannot be changed if - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - 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 - a support ticket is actively being worked upon by an Azure support engineer. In such a case, - contact your support engineer to request severity update by adding a new communication using - the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - 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: - """ - 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.SupportTicketDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_support_ticket, (IOBase, bytes)): - _content = update_support_ticket - else: - _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - - _request = build_update_request( - support_ticket_name=support_ticket_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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_support_ticket_parameters, (IOBase, bytes)): - _content = create_support_ticket_parameters - else: - _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - - _request = build_create_request( - support_ticket_name=support_ticket_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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - response_headers = {} - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: _models.SupportTicketDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. - - :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: ~azure.mgmt.support.models.SupportTicketDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Billing, and Subscription Management issues. Learn the - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - support_ticket_name: str, - 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 - `prerequisites `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`. - - :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[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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.SupportTicketDetails] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - support_ticket_name=support_ticket_name, - create_support_ticket_parameters=create_support_ticket_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_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[_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 deleted file mode 100644 index 9a9c95f7a740..000000000000 --- a/sdk/support/azure-mgmt-support/azure/mgmt/support/operations/_support_tickets_operations.py +++ /dev/null @@ -1,827 +0,0 @@ -# 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, Iterable, Optional, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -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 azure.mgmt.core.polling.arm_polling import ARMPolling - -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_check_name_availability_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", "2024-04-01")) - 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/checkNameAvailability" - ) - 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) - - -def build_list_request( - subscription_id: 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "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, 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", "2024-04-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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_update_request(support_ticket_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", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request(support_ticket_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", "2024-04-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Support/supportTickets/{supportTicketName}" - ) # pylint: disable=line-too-long - path_format_arguments = { - "supportTicketName": _SERIALIZER.url("support_ticket_name", support_ticket_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -class SupportTicketsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.support.MicrosoftSupport`'s - :attr:`support_tickets` 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 check_name_availability( - self, - check_name_availability_input: _models.CheckNameAvailabilityInput, - *, - 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: ~azure.mgmt.support.models.CheckNameAvailabilityInput - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - 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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - 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[bytes] type. Required. - :type check_name_availability_input: ~azure.mgmt.support.models.CheckNameAvailabilityInput or - IO[bytes] - :return: CheckNameAvailabilityOutput or the result of cls(response) - :rtype: ~azure.mgmt.support.models.CheckNameAvailabilityOutput - :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.CheckNameAvailabilityOutput] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(check_name_availability_input, (IOBase, bytes)): - _content = check_name_availability_input - else: - _json = self._serialize.body(check_name_availability_input, "CheckNameAvailabilityInput") - - _request = build_check_name_availability_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("CheckNameAvailabilityOutput", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, top: Optional[int] = None, filter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.SupportTicketDetails"]: - """Lists all the support tickets for an Azure subscription. You can also filter the support - tickets by *Status*\ , *CreatedDate*\ , *ServiceId*\ , and *ProblemClassificationId* using the - $filter parameter. Output will be a paged result with *nextLink*\ , using which you can - retrieve the next set of support tickets. :code:`
`:code:`
`Support ticket data is - available for 18 months after ticket creation. If a ticket was created more than 18 months ago, - a request for data might cause an error. - - :param top: The number of values to return in the collection. Default is 25 and max is 100. - Default value is None. - :type top: int - :param filter: The filter to apply on the operation. We support 'odata v4.0' filter semantics. - `Learn more `_. *Status*\ , - *ServiceId*\ , and *ProblemClassificationId* filters can only be used with Equals ('eq') - operator. For *CreatedDate* filter, the supported operators are Greater Than ('gt') and Greater - Than or Equals ('ge'). When using both filters, combine them using the logical 'AND'. Default - value is None. - :type filter: str - :return: An iterator like instance of either SupportTicketDetails or the result of - cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.support.models.SupportTicketDetails] - :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.SupportTicketsListResult] = 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( - subscription_id=self._config.subscription_id, - 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("SupportTicketsListResult", 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, **kwargs: Any) -> _models.SupportTicketDetails: - """Get ticket details for an Azure subscription. 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 - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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( - support_ticket_name=support_ticket_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - 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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - support_ticket_name: str, - update_support_ticket: _models.UpdateSupportTicket, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Required. - :type update_support_ticket: ~azure.mgmt.support.models.UpdateSupportTicket - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - support_ticket_name: str, - update_support_ticket: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.SupportTicketDetails: - """This API allows you to update the severity level, ticket status, advanced diagnostic consent - and your contact information in the support ticket.:code:`
`:code:`
`Note: The severity - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: SupportTicketDetails or the result of cls(response) - :rtype: ~azure.mgmt.support.models.SupportTicketDetails - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - 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 - levels cannot be changed if a support ticket is actively being worked upon by an Azure support - engineer. In such a case, contact your support engineer to request severity update by adding a - new communication using the Communications API. - - :param support_ticket_name: Support ticket name. Required. - :type support_ticket_name: str - :param update_support_ticket: UpdateSupportTicket object. Is either a UpdateSupportTicket type - 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: - """ - 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.SupportTicketDetails] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_support_ticket, (IOBase, bytes)): - _content = update_support_ticket - else: - _json = self._serialize.body(update_support_ticket, "UpdateSupportTicket") - - _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, - 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("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - support_ticket_name: str, - create_support_ticket_parameters: Union[_models.SupportTicketDetails, IO[bytes]], - **kwargs: Any - ) -> Optional[_models.SupportTicketDetails]: - 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[Optional[_models.SupportTicketDetails]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(create_support_ticket_parameters, (IOBase, bytes)): - _content = create_support_ticket_parameters - else: - _json = self._serialize.body(create_support_ticket_parameters, "SupportTicketDetails") - - _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, - 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, 202]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: _models.SupportTicketDetails, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, - and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation - `_. - The primary token will be from the tenant for whom a support ticket is being raised against the - subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be - from the Cloud solution provider (CSP) partner tenant. - - :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: ~azure.mgmt.support.models.SupportTicketDetails - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - support_ticket_name: str, - create_support_ticket_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SupportTicketDetails]: - """Creates a new support ticket for Subscription and Service limits (Quota), Technical, Billing, - and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation - `_. - The primary token will be from the tenant for whom a support ticket is being raised against the - subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be - from the Cloud solution provider (CSP) partner tenant. - - :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[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - support_ticket_name: str, - 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, - and Subscription Management issues for the specified subscription. Learn the `prerequisites - `_ required to create a support - ticket.:code:`
`:code:`
`Always call the Services and ProblemClassifications API to get - the most recent set of services and problem categories required for support ticket - creation.:code:`
`:code:`
`Adding attachments is not currently supported via the API. - To add a file to an existing support ticket, visit the `Manage support ticket - `_ - page in the Azure portal, select the support ticket, and use the file upload control to add a - new file.:code:`
`:code:`
`Providing consent to share diagnostic information with Azure - support is currently not supported via the API. The Azure support engineer working on your - ticket will reach out to you for consent if your issue requires gathering diagnostic - information from your Azure resources.:code:`
`:code:`
`\ **Creating a support ticket - for on-behalf-of**\ : Include *x-ms-authorization-auxiliary* header to provide an auxiliary - token as per `documentation - `_. - The primary token will be from the tenant for whom a support ticket is being raised against the - subscription, i.e. Cloud solution provider (CSP) customer tenant. The auxiliary token will be - from the Cloud solution provider (CSP) partner tenant. - - :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[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] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _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.SupportTicketDetails] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - support_ticket_name=support_ticket_name, - create_support_ticket_parameters=create_support_ticket_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("SupportTicketDetails", pipeline_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_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[_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/types.py b/sdk/support/azure-mgmt-support/azure/mgmt/support/types.py new file mode 100644 index 000000000000..f993dfbfda78 --- /dev/null +++ b/sdk/support/azure-mgmt-support/azure/mgmt/support/types.py @@ -0,0 +1,1195 @@ +# pylint: disable=line-too-long,useless-suppression,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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Literal, TYPE_CHECKING, Union +from typing_extensions import Required, TypedDict + +if TYPE_CHECKING: + from .models import ( + ActionType, + ChatConversationStatus, + CommunicationDirection, + CommunicationType, + Consent, + CreatedByType, + EscalationStatus, + IsTemporaryTicket, + Origin, + PreferredContactMethod, + SeverityLevel, + Status, + SupportChannel, + Type, + UserConsent, + ) + + +class Resource(TypedDict, total=False): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + """ + + id: str + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: str + """The name of the resource.""" + type: str + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + systemData: "SystemData" + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + """ + + +class ChatTranscriptDetails(ProxyResource): + """Object that represents a Chat Transcript resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Properties of the resource. + :vartype properties: "ChatTranscriptDetailsProperties" + """ + + properties: "ChatTranscriptDetailsProperties" + """Properties of the resource.""" + + +class ChatTranscriptDetailsProperties(TypedDict, total=False): + """Describes the properties of a Chat Transcript Details resource. + + :ivar messages: List of chat transcript communication resources. + :vartype messages: list["MessageProperties"] + :ivar start_time: Time in UTC (ISO 8601 format) when the chat began. + :vartype start_time: str + """ + + messages: list["MessageProperties"] + """List of chat transcript communication resources.""" + startTime: str + """Time in UTC (ISO 8601 format) when the chat began.""" + + +class CheckNameAvailabilityInput(TypedDict, total=False): + """Input of CheckNameAvailability API. + + :ivar name: The resource name to validate. Required. + :vartype name: str + :ivar type: The type of resource. Required. Known values are: + "Microsoft.Support/supportTickets" and "Microsoft.Support/communications". + :vartype type: Union[str, "Type"] + """ + + name: Required[str] + """The resource name to validate. Required.""" + type: Required[Union[str, "Type"]] + """The type of resource. Required. Known values are: \"Microsoft.Support/supportTickets\" and + \"Microsoft.Support/communications\".""" + + +class CheckNameAvailabilityOutput(TypedDict, total=False): + """Output of check name availability API. + + :ivar name_available: Indicates whether the name is available. + :vartype name_available: bool + :ivar reason: The reason why the name is not available. + :vartype reason: str + :ivar message: The detailed error message describing why the name is not available. + :vartype message: str + """ + + nameAvailable: bool + """Indicates whether the name is available.""" + reason: str + """The reason why the name is not available.""" + message: str + """The detailed error message describing why the name is not available.""" + + +class ClassificationService(TypedDict, total=False): + """Service Classification result object. + + :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] + """ + + serviceId: str + """Azure resource Id of the service.""" + displayName: str + """Localized name of the azure service.""" + resourceTypes: list[str] + """List of applicable ARM resource types for this service.""" + + +class CommunicationDetails(ProxyResource): + """Object that represents a Communication resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Properties of the resource. Required. + :vartype properties: "CommunicationDetailsProperties" + """ + + properties: Required["CommunicationDetailsProperties"] + """Properties of the resource. Required.""" + + +class CommunicationDetailsProperties(TypedDict, total=False): + """Describes the properties of a communication resource. + + :ivar communication_type: Communication type. Known values are: "web" and "phone". + :vartype communication_type: Union[str, "CommunicationType"] + :ivar communication_direction: Direction of communication. Known values are: "inbound" and + "outbound". + :vartype communication_direction: Union[str, "CommunicationDirection"] + :ivar sender: Email address of the sender. This property is required if called by a service + principal. + :vartype sender: str + :ivar subject: Subject of the communication. Required. + :vartype subject: str + :ivar body: Body of the communication. Required. + :vartype body: str + :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. + :vartype created_date: str + """ + + communicationType: Union[str, "CommunicationType"] + """Communication type. Known values are: \"web\" and \"phone\".""" + communicationDirection: Union[str, "CommunicationDirection"] + """Direction of communication. Known values are: \"inbound\" and \"outbound\".""" + sender: str + """Email address of the sender. This property is required if called by a service principal.""" + subject: Required[str] + """Subject of the communication. Required.""" + body: Required[str] + """Body of the communication. Required.""" + createdDate: str + """Time in UTC (ISO 8601 format) when the communication was created.""" + + +class ContactProfile(TypedDict, total=False): + """Contact information associated with the support ticket. + + :ivar first_name: First name. Required. + :vartype first_name: str + :ivar last_name: Last name. Required. + :vartype last_name: str + :ivar preferred_contact_method: Preferred contact method. Required. Known values are: "email" + and "phone". + :vartype preferred_contact_method: Union[str, "PreferredContactMethod"] + :ivar primary_email_address: Primary email address. Required. + :vartype primary_email_address: str + :ivar additional_email_addresses: Additional email addresses listed will be copied on any + correspondence about the support ticket. + :vartype additional_email_addresses: list[str] + :ivar phone_number: Phone number. This is required if preferred contact method is phone. It is + also required when submitting 'critical' or 'highestcriticalimpact' severity cases. + :vartype phone_number: str + :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from + `Microsoft Time Zone Index Values + `_. Required. + :vartype preferred_time_zone: str + :ivar country: Country of the user. This is the ISO 3166-1 alpha-3 code. Required. + :vartype country: str + :ivar preferred_support_language: Preferred language of support from Azure. Support languages + vary based on the severity you choose for your support ticket. Learn more at `Azure Severity + and responsiveness `_. Use the standard + language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for + Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. + Required. + :vartype preferred_support_language: str + """ + + firstName: Required[str] + """First name. Required.""" + lastName: Required[str] + """Last name. Required.""" + preferredContactMethod: Required[Union[str, "PreferredContactMethod"]] + """Preferred contact method. Required. Known values are: \"email\" and \"phone\".""" + primaryEmailAddress: Required[str] + """Primary email address. Required.""" + additionalEmailAddresses: list[str] + """Additional email addresses listed will be copied on any correspondence about the support + ticket.""" + phoneNumber: str + """Phone number. This is required if preferred contact method is phone. It is also required when + submitting 'critical' or 'highestcriticalimpact' severity cases.""" + preferredTimeZone: Required[str] + """Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values + `_. Required.""" + country: Required[str] + """Country of the user. This is the ISO 3166-1 alpha-3 code. Required.""" + preferredSupportLanguage: Required[str] + """Preferred language of support from Azure. Support languages vary based on the severity you + choose for your support ticket. Learn more at `Azure Severity and responsiveness + `_. Use the standard language-country code. + Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' for + French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, 'pt-br' for Portuguese, + 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. Required.""" + + +class DirectConnectEscalation(TypedDict, total=False): + """Direct Connect Escalation details for a support ticket. + + :ivar azure_ee_status: Status of Direct Connect Escalation. Known values are: + "EscalationAvailable", "EscalationInitiated", "EscalationProcessed", "EscalationUnsupported", + and "EscalationUnavailable". + :vartype azure_ee_status: Union[str, "EscalationStatus"] + :ivar allowed_severities: An array containing the allowed severities for direct connect + escalation. + :vartype allowed_severities: list[Union[str, "SeverityLevel"]] + :ivar reason_for_escalation: Reason for escalation / business impact. + :vartype reason_for_escalation: str + """ + + azureEEStatus: Union[str, "EscalationStatus"] + """Status of Direct Connect Escalation. Known values are: \"EscalationAvailable\", + \"EscalationInitiated\", \"EscalationProcessed\", \"EscalationUnsupported\", and + \"EscalationUnavailable\".""" + allowedSeverities: list[Union[str, "SeverityLevel"]] + """An array containing the allowed severities for direct connect escalation.""" + reasonForEscalation: str + """Reason for escalation / business impact.""" + + +class ErrorAdditionalInfo(TypedDict, total=False): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: Any + """ + + type: str + """The additional info type.""" + info: Any + """The additional info.""" + + +class ErrorDetail(TypedDict, total=False): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list["ErrorDetail"] + :ivar additional_info: The error additional info. + :vartype additional_info: list["ErrorAdditionalInfo"] + """ + + code: str + """The error code.""" + message: str + """The error message.""" + target: str + """The error target.""" + details: list["ErrorDetail"] + """The error details.""" + additionalInfo: list["ErrorAdditionalInfo"] + """The error additional info.""" + + +class ErrorResponse(TypedDict, total=False): + """Error response. + + :ivar error: The error object. + :vartype error: "ErrorDetail" + """ + + error: "ErrorDetail" + """The error object.""" + + +class FileDetails(ProxyResource): + """Object that represents File Details resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Properties of the resource. + :vartype properties: "FileDetailsProperties" + """ + + properties: "FileDetailsProperties" + """Properties of the resource.""" + + +class FileDetailsProperties(TypedDict, total=False): + """Describes the properties of a file. + + :ivar created_on: Time in UTC (ISO 8601 format) when file workspace was created. + :vartype created_on: str + :ivar chunk_size: Size of each chunk. The size of each chunk should be provided in bytes and + must not exceed 2.5 megabytes (MB). + :vartype chunk_size: int + :ivar file_size: Size of the file to be uploaded. The file size must not exceed 5 MB and should + be provided in bytes. + :vartype file_size: int + :ivar number_of_chunks: Number of chunks to be uploaded. The maximum number of allowed chunks + is 2. + :vartype number_of_chunks: int + """ + + createdOn: str + """Time in UTC (ISO 8601 format) when file workspace was created.""" + chunkSize: int + """Size of each chunk. The size of each chunk should be provided in bytes and must not exceed 2.5 + megabytes (MB).""" + fileSize: int + """Size of the file to be uploaded. The file size must not exceed 5 MB and should be provided in + bytes.""" + numberOfChunks: int + """Number of chunks to be uploaded. The maximum number of allowed chunks is 2.""" + + +class FileWorkspaceDetails(ProxyResource): + """Object that represents FileWorkspaceDetails resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Properties of the resource. + :vartype properties: "FileWorkspaceDetailsProperties" + """ + + properties: "FileWorkspaceDetailsProperties" + """Properties of the resource.""" + + +class FileWorkspaceDetailsProperties(TypedDict, total=False): + """Describes the properties of a file workspace. + + :ivar created_on: Time in UTC (ISO 8601 format) when file workspace was created. + :vartype created_on: str + :ivar expiration_time: Time in UTC (ISO 8601 format) when file workspace is going to expire. + :vartype expiration_time: str + """ + + createdOn: str + """Time in UTC (ISO 8601 format) when file workspace was created.""" + expirationTime: str + """Time in UTC (ISO 8601 format) when file workspace is going to expire.""" + + +class LookUpResourceIdRequest(TypedDict, total=False): + """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: Literal["Microsoft.Support/supportTickets"] + """ + + identifier: str + """The System generated Id that is unique. Use supportTicketId property for + Microsoft.Support/supportTickets resource type.""" + type: Literal["Microsoft.Support/supportTickets"] + """The type of resource. Default value is \"Microsoft.Support/supportTickets\".""" + + +class LookUpResourceIdResponse(TypedDict, total=False): + """The look up resource id response. + + :ivar resource_id: The resource Id of support resource type. + :vartype resource_id: str + """ + + resourceId: str + """The resource Id of support resource type.""" + + +class MessageProperties(TypedDict, total=False): + """Describes the properties of a Message Details resource. + + :ivar content_type: Content type. + :vartype content_type: str + :ivar communication_direction: Direction of communication. Known values are: "inbound" and + "outbound". + :vartype communication_direction: Union[str, "CommunicationDirection"] + :ivar sender: Name of the sender. + :vartype sender: str + :ivar body: Body of the communication. + :vartype body: str + :ivar created_date: Time in UTC (ISO 8601 format) when the communication was created. + :vartype created_date: str + """ + + contentType: str + """Content type.""" + communicationDirection: Union[str, "CommunicationDirection"] + """Direction of communication. Known values are: \"inbound\" and \"outbound\".""" + sender: str + """Name of the sender.""" + body: str + """Body of the communication.""" + createdDate: str + """Time in UTC (ISO 8601 format) when the communication was created.""" + + +class Operation(TypedDict, total=False): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: "OperationDisplay" + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: Union[str, "Origin"] + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: Union[str, "ActionType"] + """ + + name: str + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + isDataAction: bool + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: "OperationDisplay" + """Localized display information for this particular operation.""" + origin: Union[str, "Origin"] + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + actionType: Union[str, "ActionType"] + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + +class OperationDisplay(TypedDict, total=False): + """Localized display information for an operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: str + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: str + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: str + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: str + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class ProblemClassification(ProxyResource): + """ProblemClassification resource object. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Properties of the resource. + :vartype properties: "ProblemClassificationProperties" + """ + + properties: "ProblemClassificationProperties" + """Properties of the resource.""" + + +class ProblemClassificationProperties(TypedDict, total=False): + """Details about a problem classification available for an Azure service. + + :ivar display_name: Localized name of problem classification. + :vartype display_name: str + :ivar secondary_consent_enabled: This property indicates whether secondary consent is present + for problem classification. + :vartype secondary_consent_enabled: list["SecondaryConsentEnabled"] + """ + + displayName: str + """Localized name of problem classification.""" + secondaryConsentEnabled: list["SecondaryConsentEnabled"] + """This property indicates whether secondary consent is present for problem classification.""" + + +class ProblemClassificationsClassificationInput(TypedDict, total=False): # pylint: disable=name-too-long + """Input to problem classification Classification API. + + :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 + """ + + issueSummary: Required[str] + """Natural language description of the customer’s issue. Required.""" + resourceId: str + """ARM resource Id of the resource that is having the issue.""" + + +class ProblemClassificationsClassificationOutput(TypedDict, total=False): # 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["ProblemClassificationsClassificationResult"] + """ + + problemClassificationResults: list["ProblemClassificationsClassificationResult"] + """Set of problem classification objects classified.""" + + +class ProblemClassificationsClassificationResult(TypedDict, total=False): # pylint: disable=name-too-long + """ProblemClassification Classification result object. + + :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 related_service: Related service. + :vartype related_service: "ClassificationService" + :ivar article_id: Identifier of the article associated with this problem classification result. + This value is populated only when a related article is available; otherwise it is omitted. + :vartype article_id: str + """ + + problemId: str + """Identifier that may be used for solution discovery or some other purposes.""" + title: str + """Title of the problem classification result.""" + description: str + """Description of the problem classification result.""" + serviceId: str + """Identifier of the service associated with this problem classification result.""" + problemClassificationId: str + """Identifier that may be used for support ticket creation.""" + relatedService: "ClassificationService" + """Related service.""" + articleId: str + """Identifier of the article associated with this problem classification result. This value is + populated only when a related article is available; otherwise it is omitted.""" + + +class QuotaChangeRequest(TypedDict, total=False): + """This property is required for providing the region and new quota limits. + + :ivar region: Region for which the quota increase request is being made. + :vartype region: str + :ivar payload: Payload of the quota increase request. + :vartype payload: str + """ + + region: str + """Region for which the quota increase request is being made.""" + payload: str + """Payload of the quota increase request.""" + + +class QuotaTicketDetails(TypedDict, total=False): + """Additional set of information required for quota increase support ticket for certain quota + types, e.g.: Virtual machine cores. Get complete details about Quota payload support request + along with examples at `Support quota request `_. + + :ivar quota_change_request_sub_type: Required for certain quota types when there is a sub type, + such as Batch, for which you are requesting a quota increase. + :vartype quota_change_request_sub_type: str + :ivar quota_change_request_version: Quota change request version. + :vartype quota_change_request_version: str + :ivar quota_change_requests: This property is required for providing the region and new quota + limits. + :vartype quota_change_requests: list["QuotaChangeRequest"] + """ + + quotaChangeRequestSubType: str + """Required for certain quota types when there is a sub type, such as Batch, for which you are + requesting a quota increase.""" + quotaChangeRequestVersion: str + """Quota change request version.""" + quotaChangeRequests: list["QuotaChangeRequest"] + """This property is required for providing the region and new quota limits.""" + + +class SecondaryConsent(TypedDict, total=False): + """This property indicates secondary consent for the support ticket. + + :ivar user_consent: User consent value provided. Known values are: "Yes" and "No". + :vartype user_consent: Union[str, "UserConsent"] + :ivar type: The service name for which the secondary consent is being provided. The value needs + to be retrieved from the Problem Classification API response. + :vartype type: str + """ + + userConsent: Union[str, "UserConsent"] + """User consent value provided. Known values are: \"Yes\" and \"No\".""" + type: str + """The service name for which the secondary consent is being provided. The value needs to be + retrieved from the Problem Classification API response.""" + + +class SecondaryConsentEnabled(TypedDict, total=False): + """This property indicates whether secondary consent is present for problem classification. + + :ivar description: User consent description. + :vartype description: str + :ivar type: The Azure service for which secondary consent is needed for case creation. + :vartype type: str + """ + + description: str + """User consent description.""" + type: str + """The Azure service for which secondary consent is needed for case creation.""" + + +class Service(ProxyResource): + """Object that represents a Service resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Properties of the resource. + :vartype properties: "ServiceProperties" + """ + + properties: "ServiceProperties" + """Properties of the resource.""" + + +class ServiceClassificationAnswer(ClassificationService): + """Service Classification result object. + + :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: "ClassificationService" + """ + + childService: "ClassificationService" + """Child service.""" + + +class ServiceClassificationOutput(TypedDict, total=False): + """Output of the service classification API. + + :ivar service_classification_results: Set of problem classification objects classified. + :vartype service_classification_results: list["ServiceClassificationAnswer"] + """ + + serviceClassificationResults: list["ServiceClassificationAnswer"] + """Set of problem classification objects classified.""" + + +class ServiceClassificationRequest(TypedDict, total=False): + """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 + """ + + issueSummary: str + """Natural language description of the customer’s issue.""" + resourceId: str + """ARM resource Id of the resource that is having the issue.""" + additionalContext: str + """Additional information in the form of a string.""" + + +class ServiceLevelAgreement(TypedDict, total=False): + """Service Level Agreement details for a support ticket. + + :ivar start_time: Time in UTC (ISO 8601 format) when the service level agreement starts. + :vartype start_time: str + :ivar expiration_time: Time in UTC (ISO 8601 format) when the service level agreement expires. + :vartype expiration_time: str + :ivar sla_minutes: Service Level Agreement in minutes. + :vartype sla_minutes: int + """ + + startTime: str + """Time in UTC (ISO 8601 format) when the service level agreement starts.""" + expirationTime: str + """Time in UTC (ISO 8601 format) when the service level agreement expires.""" + slaMinutes: int + """Service Level Agreement in minutes.""" + + +class ServiceProperties(TypedDict, total=False): + """Details about an Azure service available for support ticket creation. + + :ivar display_name: Localized name of the Azure service. + :vartype display_name: str + :ivar resource_types: ARM Resource types. + :vartype resource_types: list[str] + """ + + displayName: str + """Localized name of the Azure service.""" + resourceTypes: list[str] + """ARM Resource types.""" + + +class SupportEngineer(TypedDict, total=False): + """Support engineer information. + + :ivar email_address: Email address of the Azure Support engineer assigned to the support + ticket. + :vartype email_address: str + """ + + emailAddress: str + """Email address of the Azure Support engineer assigned to the support ticket.""" + + +class SupportTicketDetails(ProxyResource): + """Object that represents SupportTicketDetails resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: "SystemData" + :ivar properties: Properties of the resource. Required. + :vartype properties: "SupportTicketDetailsProperties" + """ + + properties: Required["SupportTicketDetailsProperties"] + """Properties of the resource. Required.""" + + +class SupportTicketDetailsProperties(TypedDict, total=False): + """Describes the properties of a support ticket. + + :ivar support_ticket_id: System generated support ticket Id that is unique. + :vartype support_ticket_id: str + :ivar description: Detailed description of the question or issue. Required. + :vartype description: str + :ivar problem_classification_id: Each Azure service has its own set of issue categories, also + known as problem classification. This parameter is the unique Id for the type of problem you + are experiencing. Required. + :vartype problem_classification_id: str + :ivar problem_classification_display_name: Localized name of problem classification. + :vartype problem_classification_display_name: str + :ivar severity: A value that indicates the urgency of the case, which in turn determines the + response time according to the service level agreement of the technical support plan you have + with Azure. Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' + level in the Azure portal is reserved only for our Premium customers. Required. Known values + are: "minimal", "moderate", "critical", and "highestcriticalimpact". + :vartype severity: Union[str, "SeverityLevel"] + :ivar enrollment_id: Enrollment Id associated with the support ticket. + :vartype enrollment_id: str + :ivar require24_x7_response: Indicates if this requires a 24x7 response from Azure. + :vartype require24_x7_response: bool + :ivar advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support + ticket. Required. Known values are: "Yes" and "No". + :vartype advanced_diagnostic_consent: Union[str, "Consent"] + :ivar problem_scoping_questions: Problem scoping questions associated with the support ticket. + :vartype problem_scoping_questions: str + :ivar support_plan_id: Support plan id associated with the support ticket. + :vartype support_plan_id: str + :ivar contact_details: Contact information of the user requesting to create a support ticket. + Required. + :vartype contact_details: "ContactProfile" + :ivar service_level_agreement: Service Level Agreement information for this support ticket. + :vartype service_level_agreement: "ServiceLevelAgreement" + :ivar support_engineer: Information about the support engineer working on this support ticket. + :vartype support_engineer: "SupportEngineer" + :ivar support_plan_type: Support plan type associated with the support ticket. + :vartype support_plan_type: str + :ivar support_plan_display_name: Support plan type associated with the support ticket. + :vartype support_plan_display_name: str + :ivar title: Title of the support ticket. Required. + :vartype title: str + :ivar problem_start_time: Time in UTC (ISO 8601 format) when the problem started. + :vartype problem_start_time: str + :ivar service_id: This is the resource Id of the Azure service resource associated with the + support ticket. Required. + :vartype service_id: str + :ivar service_display_name: Localized name of the Azure service. + :vartype service_display_name: str + :ivar status: Status of the support ticket. + :vartype status: str + :ivar created_date: Time in UTC (ISO 8601 format) when the support ticket was created. + :vartype created_date: str + :ivar modified_date: Time in UTC (ISO 8601 format) when the support ticket was last modified. + :vartype modified_date: str + :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: Union[str, "IsTemporaryTicket"] + :ivar technical_ticket_details: Additional ticket details associated with a technical support + ticket request. + :vartype technical_ticket_details: "TechnicalTicketDetails" + :ivar quota_ticket_details: Additional ticket details associated with a quota support ticket + request. + :vartype quota_ticket_details: "QuotaTicketDetails" + :ivar secondary_consent: This property indicates secondary consents for the support ticket. + :vartype secondary_consent: list["SecondaryConsent"] + :ivar direct_connect_escalation: Direct Connect Escalation details for a support ticket. + :vartype direct_connect_escalation: "DirectConnectEscalation" + :ivar community_forum_post: Contains a link to the post on the community forum. + :vartype community_forum_post: str + :ivar support_channel: Support channel type for the support ticket. Known values are: "Chat" + and "Web". + :vartype support_channel: Union[str, "SupportChannel"] + :ivar chat_conversation_status: Status of the chat conversation associated with the support + ticket. Known values are: "Active" and "Closed". + :vartype chat_conversation_status: Union[str, "ChatConversationStatus"] + """ + + supportTicketId: str + """System generated support ticket Id that is unique.""" + description: Required[str] + """Detailed description of the question or issue. Required.""" + problemClassificationId: Required[str] + """Each Azure service has its own set of issue categories, also known as problem classification. + This parameter is the unique Id for the type of problem you are experiencing. Required.""" + problemClassificationDisplayName: str + """Localized name of problem classification.""" + severity: Required[Union[str, "SeverityLevel"]] + """A value that indicates the urgency of the case, which in turn determines the response time + according to the service level agreement of the technical support plan you have with Azure. + Note: 'Highest critical impact', also known as the 'Emergency - Severe impact' level in the + Azure portal is reserved only for our Premium customers. Required. Known values are: + \"minimal\", \"moderate\", \"critical\", and \"highestcriticalimpact\".""" + enrollmentId: str + """Enrollment Id associated with the support ticket.""" + require24X7Response: bool + """Indicates if this requires a 24x7 response from Azure.""" + advancedDiagnosticConsent: Required[Union[str, "Consent"]] + """Advanced diagnostic consent to be updated on the support ticket. Required. Known values are: + \"Yes\" and \"No\".""" + problemScopingQuestions: str + """Problem scoping questions associated with the support ticket.""" + supportPlanId: str + """Support plan id associated with the support ticket.""" + contactDetails: Required["ContactProfile"] + """Contact information of the user requesting to create a support ticket. Required.""" + serviceLevelAgreement: "ServiceLevelAgreement" + """Service Level Agreement information for this support ticket.""" + supportEngineer: "SupportEngineer" + """Information about the support engineer working on this support ticket.""" + supportPlanType: str + """Support plan type associated with the support ticket.""" + supportPlanDisplayName: str + """Support plan type associated with the support ticket.""" + title: Required[str] + """Title of the support ticket. Required.""" + problemStartTime: str + """Time in UTC (ISO 8601 format) when the problem started.""" + serviceId: Required[str] + """This is the resource Id of the Azure service resource associated with the support ticket. + Required.""" + serviceDisplayName: str + """Localized name of the Azure service.""" + status: str + """Status of the support ticket.""" + createdDate: str + """Time in UTC (ISO 8601 format) when the support ticket was created.""" + modifiedDate: str + """Time in UTC (ISO 8601 format) when the support ticket was last modified.""" + fileWorkspaceName: str + """File workspace name.""" + isTemporaryTicket: Union[str, "IsTemporaryTicket"] + """This property indicates if support ticket is a temporary ticket. Known values are: \"Yes\" and + \"No\".""" + technicalTicketDetails: "TechnicalTicketDetails" + """Additional ticket details associated with a technical support ticket request.""" + quotaTicketDetails: "QuotaTicketDetails" + """Additional ticket details associated with a quota support ticket request.""" + secondaryConsent: list["SecondaryConsent"] + """This property indicates secondary consents for the support ticket.""" + directConnectEscalation: "DirectConnectEscalation" + """Direct Connect Escalation details for a support ticket.""" + communityForumPost: str + """Contains a link to the post on the community forum.""" + supportChannel: Union[str, "SupportChannel"] + """Support channel type for the support ticket. Known values are: \"Chat\" and \"Web\".""" + chatConversationStatus: Union[str, "ChatConversationStatus"] + """Status of the chat conversation associated with the support ticket. Known values are: + \"Active\" and \"Closed\".""" + + +class SystemData(TypedDict, total=False): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: Union[str, "CreatedByType"] + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: str + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: Union[str, "CreatedByType"] + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: str + """ + + createdBy: str + """The identity that created the resource.""" + createdByType: Union[str, "CreatedByType"] + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + createdAt: str + """The timestamp of resource creation (UTC).""" + lastModifiedBy: str + """The identity that last modified the resource.""" + lastModifiedByType: Union[str, "CreatedByType"] + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + lastModifiedAt: str + """The timestamp of resource last modification (UTC).""" + + +class TechnicalTicketDetails(TypedDict, total=False): + """Additional information for technical support ticket. + + :ivar resource_id: This is the resource Id of the Azure service resource (For example: A + virtual machine resource or an HDInsight resource) for which the support ticket is created. + :vartype resource_id: str + """ + + resourceId: str + """This is the resource Id of the Azure service resource (For example: A virtual machine resource + or an HDInsight resource) for which the support ticket is created.""" + + +class UpdateContactProfile(TypedDict, total=False): + """Contact information associated with the support ticket. + + :ivar first_name: First name. + :vartype first_name: str + :ivar last_name: Last name. + :vartype last_name: str + :ivar preferred_contact_method: Preferred contact method. Known values are: "email" and + "phone". + :vartype preferred_contact_method: Union[str, "PreferredContactMethod"] + :ivar primary_email_address: Primary email address. + :vartype primary_email_address: str + :ivar additional_email_addresses: Email addresses listed will be copied on any correspondence + about the support ticket. + :vartype additional_email_addresses: list[str] + :ivar phone_number: Phone number. This is required if preferred contact method is phone. It is + also required when submitting 'critical' or 'highestcriticalimpact' severity cases. + :vartype phone_number: str + :ivar preferred_time_zone: Time zone of the user. This is the name of the time zone from + `Microsoft Time Zone Index Values + `_. + :vartype preferred_time_zone: str + :ivar country: Country of the user. This is the ISO 3166-1 alpha-3 code. + :vartype country: str + :ivar preferred_support_language: Preferred language of support from Azure. Support languages + vary based on the severity you choose for your support ticket. Learn more at `Azure Severity + and responsiveness `_. Use the standard + language-country code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for + Spanish, 'fr-fr' for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, + 'pt-br' for Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German. + :vartype preferred_support_language: str + """ + + firstName: str + """First name.""" + lastName: str + """Last name.""" + preferredContactMethod: Union[str, "PreferredContactMethod"] + """Preferred contact method. Known values are: \"email\" and \"phone\".""" + primaryEmailAddress: str + """Primary email address.""" + additionalEmailAddresses: list[str] + """Email addresses listed will be copied on any correspondence about the support ticket.""" + phoneNumber: str + """Phone number. This is required if preferred contact method is phone. It is also required when + submitting 'critical' or 'highestcriticalimpact' severity cases.""" + preferredTimeZone: str + """Time zone of the user. This is the name of the time zone from `Microsoft Time Zone Index Values + `_.""" + country: str + """Country of the user. This is the ISO 3166-1 alpha-3 code.""" + preferredSupportLanguage: str + """Preferred language of support from Azure. Support languages vary based on the severity you + choose for your support ticket. Learn more at `Azure Severity and responsiveness + `_. Use the standard language-country + code. Valid values are 'en-us' for English, 'zh-hans' for Chinese, 'es-es' for Spanish, 'fr-fr' + for French, 'ja-jp' for Japanese, 'ko-kr' for Korean, 'ru-ru' for Russian, 'pt-br' for + Portuguese, 'it-it' for Italian, 'zh-tw' for Chinese and 'de-de' for German.""" + + +class UpdateSupportTicket(TypedDict, total=False): + """Updates severity, ticket status, contact details, advanced diagnostic consent and secondary + consent in the support ticket. + + :ivar severity: Severity level. Known values are: "minimal", "moderate", "critical", and + "highestcriticalimpact". + :vartype severity: Union[str, "SeverityLevel"] + :ivar status: Status to be updated on the ticket. Known values are: "open" and "closed". + :vartype status: Union[str, "Status"] + :ivar contact_details: Contact details to be updated on the support ticket. + :vartype contact_details: "UpdateContactProfile" + :ivar advanced_diagnostic_consent: Advanced diagnostic consent to be updated on the support + ticket. Known values are: "Yes" and "No". + :vartype advanced_diagnostic_consent: Union[str, "Consent"] + :ivar secondary_consent: This property indicates secondary consents for the support ticket. + :vartype secondary_consent: list["SecondaryConsent"] + :ivar direct_connect_escalation: Direct Connect Escalation details for a support ticket. + :vartype direct_connect_escalation: "DirectConnectEscalation" + """ + + severity: Union[str, "SeverityLevel"] + """Severity level. Known values are: \"minimal\", \"moderate\", \"critical\", and + \"highestcriticalimpact\".""" + status: Union[str, "Status"] + """Status to be updated on the ticket. Known values are: \"open\" and \"closed\".""" + contactDetails: "UpdateContactProfile" + """Contact details to be updated on the support ticket.""" + advancedDiagnosticConsent: Union[str, "Consent"] + """Advanced diagnostic consent to be updated on the support ticket. Known values are: \"Yes\" and + \"No\".""" + secondaryConsent: list["SecondaryConsent"] + """This property indicates secondary consents for the support ticket.""" + directConnectEscalation: "DirectConnectEscalation" + """Direct Connect Escalation details for a support ticket.""" + + +class UploadFile(TypedDict, total=False): + """File content associated with the file under a workspace. + + :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: int + """ + + content: str + """File Content in base64 encoded format.""" + chunkIndex: int + """Index of the uploaded chunk (Index starts at 0).""" diff --git a/sdk/support/azure-mgmt-support/dev_requirements.txt b/sdk/support/azure-mgmt-support/dev_requirements.txt index b18a83fbb955..dae351c8077f 100644 --- a/sdk/support/azure-mgmt-support/dev_requirements.txt +++ b/sdk/support/azure-mgmt-support/dev_requirements.txt @@ -1 +1,3 @@ --e ../../../eng/tools/azure-sdk-tools \ No newline at end of file +-e ../../../eng/tools/azure-sdk-tools +aiohttp +azure-mgmt-resource \ No newline at end of file diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability.py index f83f10a7b1d8..4a69a96cae44 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -38,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailability.json +# x-ms-original-file: 2026-07-01/CheckNameAvailability.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_no_subscription_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_no_subscription_support_ticket_communication.py index 8a49408f5129..66809c3c8092 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailabilityForNoSubscriptionSupportTicketCommunication.json +# x-ms-original-file: 2026-07-01/CheckNameAvailabilityForNoSubscriptionSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_for_support_ticket_communication.py index 1432722ef48e..8034550ad99e 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.communications.check_name_availability( @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailabilityForSupportTicketCommunication.json +# x-ms-original-file: 2026-07-01/CheckNameAvailabilityForSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_with_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/check_name_availability_with_subscription.py index e4e782b75da0..ccc092ac860d 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.check_name_availability( @@ -38,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CheckNameAvailabilityWithSubscription.json +# x-ms-original-file: 2026-07-01/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..d103d79aa9ca --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.support import SupportMgmtClient + +""" +# 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 = SupportMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.classify_problems_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: 2026-07-01/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..b005f0c427c9 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_problem_classifications_for_subscription.py @@ -0,0 +1,46 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.support import SupportMgmtClient + +""" +# 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 = SupportMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.classify_problems.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: 2026-07-01/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..2b7c1f0693a6 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_services.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.support import SupportMgmtClient + +""" +# 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 = SupportMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.classify_services_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: 2026-07-01/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..96c0337f4fb0 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/classify_services_for_subscription.py @@ -0,0 +1,45 @@ +# pylint: disable=line-too-long,useless-suppression +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.support import SupportMgmtClient + +""" +# 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 = SupportMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.classify_services.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: 2026-07-01/ClassifyServicesForSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py index 201ec42c20c2..77ad52d54bb9 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_active_jobs.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForActiveJobs.json +# x-ms-original-file: 2026-07-01/CreateBatchQuotaTicketForSpecificBatchAccountForActiveJobs.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py index e25dd7ab55d1..9a26f4acbc0a 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_dedicated_cores.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -68,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForDedicatedCores.json +# x-ms-original-file: 2026-07-01/CreateBatchQuotaTicketForSpecificBatchAccountForDedicatedCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py index 1c78299a0f90..c7ed53312d0a 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_low_priority_cores.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForLowPriorityCores.json +# x-ms-original-file: 2026-07-01/CreateBatchQuotaTicketForSpecificBatchAccountForLowPriorityCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py index d97968923e63..8fd15160e7d8 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_specific_batch_account_for_pools.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSpecificBatchAccountForPools.json +# x-ms-original-file: 2026-07-01/CreateBatchQuotaTicketForSpecificBatchAccountForPools.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py index 5da11c666290..d429405736e6 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_batch_quota_ticket_for_subscription.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBatchQuotaTicketForSubscription.json +# x-ms-original-file: 2026-07-01/CreateBatchQuotaTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py index 7facd9c7bb39..f07eb71cdb4a 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +26,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -59,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBillingSupportTicket.json +# x-ms-original-file: 2026-07-01/CreateBillingSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py index 609ede7789b3..75c1f512c6b4 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_billing_support_ticket_for_subscription.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -59,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateBillingSupportTicketForSubscription.json +# x-ms-original-file: 2026-07-01/CreateBillingSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py index 77b4a9ae699a..b626d2ebc3b9 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_cores_quota_ticket_for_subscription.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -62,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateCoresQuotaTicketForSubscription.json +# x-ms-original-file: 2026-07-01/CreateCoresQuotaTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file.py b/sdk/support/azure-mgmt-support/generated_samples/create_file.py index ec7bf878433d..3b9f4303be96 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_file.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_file.py @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFile.json +# x-ms-original-file: 2026-07-01/CreateFile.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_file_for_subscription.py index 237aff1173db..94401f9e1304 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.files.create( @@ -40,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFileForSubscription.json +# x-ms-original-file: 2026-07-01/CreateFileForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace.py b/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace.py index 3f8422e93f00..429046413c16 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFileWorkspace.json +# x-ms-original-file: 2026-07-01/CreateFileWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_file_workspace_for_subscription.py index 7be82e339382..e9d46774c3ba 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.file_workspaces.create( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateFileWorkspaceForSubscription.json +# x-ms-original-file: 2026-07-01/CreateFileWorkspaceForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py index d314e0c6ae2a..8a270a011df9 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_generic_quota_ticket.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -57,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateGenericQuotaTicket.json +# x-ms-original-file: 2026-07-01/CreateGenericQuotaTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py index f95080a3c51f..76e2e1da15f4 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_dedicated_cores.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -68,6 +67,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateMachineLearningQuotaTicketForDedicatedCores.json +# x-ms-original-file: 2026-07-01/CreateMachineLearningQuotaTicketForDedicatedCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py index 44ff700028a5..6dcb66a1526d 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_machine_learning_quota_ticket_for_low_priority_cores.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateMachineLearningQuotaTicketForLowPriorityCores.json +# x-ms-original-file: 2026-07-01/CreateMachineLearningQuotaTicketForLowPriorityCores.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_no_subscription_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/create_no_subscription_support_ticket_communication.py index eef2a18f6d3c..2cd87241ec7e 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -46,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateNoSubscriptionSupportTicketCommunication.json +# x-ms-original-file: 2026-07-01/CreateNoSubscriptionSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py index 32099f323ad9..7c48c2744581 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_dtus.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatabaseQuotaTicketForDTUs.json +# x-ms-original-file: 2026-07-01/CreateSqlDatabaseQuotaTicketForDTUs.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py index cca555c98d93..d727eb4b48bd 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_database_quota_ticket_for_servers.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatabaseQuotaTicketForServers.json +# x-ms-original-file: 2026-07-01/CreateSqlDatabaseQuotaTicketForServers.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py index 1fc44e2e28f9..1bafdcc517c8 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_dtus.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -65,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatawarehouseQuotaTicketForDTUs.json +# x-ms-original-file: 2026-07-01/CreateSqlDatawarehouseQuotaTicketForDTUs.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py index 9c2f40077aef..87b31f2a4291 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_datawarehouse_quota_ticket_for_servers.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -63,6 +62,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlDatawarehouseQuotaTicketForServers.json +# x-ms-original-file: 2026-07-01/CreateSqlDatawarehouseQuotaTicketForServers.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py index e1ac8f328ab2..e5c684b3fbe4 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sql_managed_instance_quota_ticket.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -66,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSqlManagedInstanceQuotaTicket.json +# x-ms-original-file: 2026-07-01/CreateSqlManagedInstanceQuotaTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py index 1bbad7128cd0..3bca68f3d3bb 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +26,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -59,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSubMgmtSupportTicket.json +# x-ms-original-file: 2026-07-01/CreateSubMgmtSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py index 25cd5acf9a91..afe3b935431f 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_sub_mgmt_support_ticket_for_subscription.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -59,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSubMgmtSupportTicketForSubscription.json +# x-ms-original-file: 2026-07-01/CreateSubMgmtSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_support_ticket_communication.py b/sdk/support/azure-mgmt-support/generated_samples/create_support_ticket_communication.py index 11e6b079c8b5..5b47d662709d 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.communications.begin_create( @@ -46,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateSupportTicketCommunication.json +# x-ms-original-file: 2026-07-01/CreateSupportTicketCommunication.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py index 70d7f416840b..5e9300c7260b 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +26,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +36,7 @@ def main(): create_support_ticket_parameters={ "properties": { "advancedDiagnosticConsent": "Yes", + "communityForumPost": "https://learn.microsoft.com/en-us/answers/questions/2283704/unverified-app-listed-under-applications-from-pers", "contactDetails": { "country": "usa", "firstName": "abc", @@ -61,6 +61,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateTechnicalSupportTicket.json +# x-ms-original-file: 2026-07-01/CreateTechnicalSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py index 0b292dbf0f94..9d99f8194a2b 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/create_technical_support_ticket_for_subscription.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.begin_create( @@ -37,6 +36,7 @@ def main(): create_support_ticket_parameters={ "properties": { "advancedDiagnosticConsent": "Yes", + "communityForumPost": "https://learn.microsoft.com/en-us/answers/questions/2283704/unverified-app-listed-under-applications-from-pers", "contactDetails": { "country": "usa", "firstName": "abc", @@ -64,6 +64,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/CreateTechnicalSupportTicketForSubscription.json +# x-ms-original-file: 2026-07-01/CreateTechnicalSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_subscription_support_ticket.py index e1bcfbb4d638..23f0d56218bd 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.communications.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetCommunicationDetailsForSubscriptionSupportTicket.json +# x-ms-original-file: 2026-07-01/GetCommunicationDetailsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/get_communication_details_for_support_ticket.py index e2ff54027f82..5e29e4d1fd4d 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetCommunicationDetailsForSupportTicket.json +# x-ms-original-file: 2026-07-01/GetCommunicationDetailsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_details.py index 155d96f6d149..5fcca5658816 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileDetails.json +# x-ms-original-file: 2026-07-01/GetFileDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_details_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_details_for_subscription.py index b5f74a3a28d0..850c4c41e04a 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.files.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileDetailsForSubscription.json +# x-ms-original-file: 2026-07-01/GetFileDetailsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details.py index 9c9880bea433..614fc626955b 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileWorkspaceDetails.json +# x-ms-original-file: 2026-07-01/GetFileWorkspaceDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/get_file_workspace_details_for_subscription.py index 7254994d8c16..f364a4f61ec7 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.file_workspaces.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetFileWorkspaceDetailsForSubscription.json +# x-ms-original-file: 2026-07-01/GetFileWorkspaceDetailsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_problem_classification.py b/sdk/support/azure-mgmt-support/generated_samples/get_problem_classification.py index d985362e96b8..d68d4070bfc1 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetProblemClassification.json +# x-ms-original-file: 2026-07-01/GetProblemClassification.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_service.py b/sdk/support/azure-mgmt-support/generated_samples/get_service.py index 6afa7e4fe239..baeadc895f85 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/get_service.py +++ b/sdk/support/azure-mgmt-support/generated_samples/get_service.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetService.json +# x-ms-original-file: 2026-07-01/GetService.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_subscription_support_ticket_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_subscription_support_ticket_details.py index 75629c95895d..12dcbf5d308b 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.get( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetSubscriptionSupportTicketDetails.json +# x-ms-original-file: 2026-07-01/GetSubscriptionSupportTicketDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/get_support_ticket_details.py b/sdk/support/azure-mgmt-support/generated_samples/get_support_ticket_details.py index 2a25fee7c9e2..71ab19e61718 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetSupportTicketDetails.json +# x-ms-original-file: 2026-07-01/GetSupportTicketDetails.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_subscription_support_ticket.py index f82f6f92bcaa..934c1fbdd96c 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.chat_transcripts.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetchatTranscriptDetailsForSubscriptionSupportTicket.json +# x-ms-original-file: 2026-07-01/GetchatTranscriptDetailsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/getchat_transcript_details_for_support_ticket.py index 8f6a6f4a9595..d9c3ebee9419 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/GetchatTranscriptDetailsForSupportTicket.json +# x-ms-original-file: 2026-07-01/GetchatTranscriptDetailsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_subscription_support_ticket.py index 845f4567160e..03fc30041915 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.chat_transcripts.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListChatTranscriptsForSubscriptionSupportTicket.json +# x-ms-original-file: 2026-07-01/ListChatTranscriptsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_chat_transcripts_for_support_ticket.py index 984b21292d76..447ce741b902 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListChatTranscriptsForSupportTicket.json +# x-ms-original-file: 2026-07-01/ListChatTranscriptsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_subscription_support_ticket.py index b8fda155d9d3..58fcb335d1da 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.communications.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListCommunicationsForSubscriptionSupportTicket.json +# x-ms-original-file: 2026-07-01/ListCommunicationsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_communications_for_support_ticket.py index d60c87b5b8b0..21c8c8e488e5 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListCommunicationsForSupportTicket.json +# x-ms-original-file: 2026-07-01/ListCommunicationsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_files_for_subscription_under_file_workspace.py b/sdk/support/azure-mgmt-support/generated_samples/list_files_for_subscription_under_file_workspace.py index 99638db9ea9a..52e83f04cb6f 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.files.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListFilesForSubscriptionUnderFileWorkspace.json +# x-ms-original-file: 2026-07-01/ListFilesForSubscriptionUnderFileWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_files_under_file_workspace.py b/sdk/support/azure-mgmt-support/generated_samples/list_files_under_file_workspace.py index afe2c8209c09..a1e78c9db1ff 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListFilesUnderFileWorkspace.json +# x-ms-original-file: 2026-07-01/ListFilesUnderFileWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_operations.py b/sdk/support/azure-mgmt-support/generated_samples/list_operations.py index 8a26c2b5b440..8585a040d524 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_operations.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_operations.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListOperations.json +# x-ms-original-file: 2026-07-01/ListOperations.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_problem_classifications.py b/sdk/support/azure-mgmt-support/generated_samples/list_problem_classifications.py index fe8104b96f53..c1679d23b110 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListProblemClassifications.json +# x-ms-original-file: 2026-07-01/ListProblemClassifications.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_services.py b/sdk/support/azure-mgmt-support/generated_samples/list_services.py index 5c29dc1036a5..0a1404ba9a45 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/list_services.py +++ b/sdk/support/azure-mgmt-support/generated_samples/list_services.py @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListServices.json +# x-ms-original-file: 2026-07-01/ListServices.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets.py index 5402342c9711..f674f218afb1 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTickets.json +# x-ms-original-file: 2026-07-01/ListSupportTickets.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_by_subscription.py index 50caa59cf10a..024860dcf148 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsBySubscription.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state.py index 8f5eac42a009..851b9fe4892e 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenState.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsCreatedOnOrAfterAndInOpenState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_open_state_by_subscription.py index 37be084c986e..aee6148e6a55 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInOpenStateBySubscription.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsCreatedOnOrAfterAndInOpenStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state.py index a87c84812596..bdebf128f082 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingState.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsCreatedOnOrAfterAndInUpdatingState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_created_on_or_after_and_in_updating_state_by_subscription.py index 806c49721ef1..088892c4bc85 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsCreatedOnOrAfterAndInUpdatingStateBySubscription.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsCreatedOnOrAfterAndInUpdatingStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state.py index bd2e98cfcd66..b9e216de0b32 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInOpenState.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsInOpenState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_open_state_by_subscription.py index b3207763d547..8b68c9771889 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInOpenStateBySubscription.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsInOpenStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state.py index e603fe049a8b..5807854699f4 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInUpdatingState.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsInUpdatingState.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state_by_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_in_updating_state_by_subscription.py index c6d5a5748964..dfe915fddddd 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsInUpdatingStateBySubscription.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsInUpdatingStateBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals.py index 58e993d343cc..c632f32b3b6c 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsProblemClassificationIdEquals.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsProblemClassificationIdEquals.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_problem_classification_id_equals_for_subscription.py index d78bf90a4b28..adc22ff435ed 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsProblemClassificationIdEqualsForSubscription.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsProblemClassificationIdEqualsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals.py index e76f01a79290..f078a1ed34e2 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsServiceIdEquals.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsServiceIdEquals.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/list_support_tickets_service_id_equals_for_subscription.py index d724f34b0873..46c1b7310182 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListSupportTicketsServiceIdEqualsForSubscription.json +# x-ms-original-file: 2026-07-01/ListSupportTicketsServiceIdEqualsForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket.py index 2d5d9bfe6584..2eabf351258b 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.communications.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSubscriptionSupportTicket.json +# x-ms-original-file: 2026-07-01/ListWebCommunicationsForSubscriptionSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket_created_on_or_after.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_subscription_support_ticket_created_on_or_after.py index a2401aecb337..d2f65a8acb34 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.communications.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSubscriptionSupportTicketCreatedOnOrAfter.json +# x-ms-original-file: 2026-07-01/ListWebCommunicationsForSubscriptionSupportTicketCreatedOnOrAfter.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket.py index 4f292da979d3..31e5d7aa073f 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSupportTicket.json +# x-ms-original-file: 2026-07-01/ListWebCommunicationsForSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket_created_on_or_after.py b/sdk/support/azure-mgmt-support/generated_samples/list_web_communications_for_support_ticket_created_on_or_after.py index 4f8f563d813f..1b17ae7ce4ee 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 @@ -2,13 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.support import MicrosoftSupport +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/ListWebCommunicationsForSupportTicketCreatedOnOrAfter.json +# x-ms-original-file: 2026-07-01/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..998a027ac762 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/look_up_resource_id.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.support import SupportMgmtClient + +""" +# 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 = SupportMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.support_tickets.look_up_resource_id( + look_up_resource_id_request={"identifier": "1234668596", "type": "Microsoft.Support/supportTickets"}, + ) + print(response) + + +# x-ms-original-file: 2026-07-01/LookUpResourceId.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket.py index fe4b106632a4..2567dbd18eb6 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateAdvancedDiagnosticConsentOfSupportTicket.json +# x-ms-original-file: 2026-07-01/UpdateAdvancedDiagnosticConsentOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_advanced_diagnostic_consent_of_support_ticket_for_subscription.py index e84af5fcb6cb..0ef4acfc32f3 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.update( @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateAdvancedDiagnosticConsentOfSupportTicketForSubscription.json +# x-ms-original-file: 2026-07-01/UpdateAdvancedDiagnosticConsentOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket.py index 90508f2e6a43..6a0f52d0d03a 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -51,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateContactDetailsOfSupportTicket.json +# x-ms-original-file: 2026-07-01/UpdateContactDetailsOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_contact_details_of_support_ticket_for_subscription.py index 21c6ddc77e3b..56d0b9116be2 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.update( @@ -51,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateContactDetailsOfSupportTicketForSubscription.json +# x-ms-original-file: 2026-07-01/UpdateContactDetailsOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_escalation_status_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_escalation_status_of_support_ticket.py new file mode 100644 index 000000000000..a6d489121d6d --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/update_escalation_status_of_support_ticket.py @@ -0,0 +1,48 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.support import SupportMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-support +# USAGE + python update_escalation_status_of_support_ticket.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 = SupportMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.support_tickets_no_subscription.update( + support_ticket_name="testticket", + update_support_ticket={ + "contactDetails": {"phoneNumber": "123-456-7890"}, + "directConnectEscalation": { + "azureEEStatus": "EscalationInitiated", + "reasonForEscalation": "Server is down and business is impacted", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2026-07-01/UpdateEscalationStatusOfSupportTicket.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_escalation_status_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_escalation_status_of_support_ticket_for_subscription.py new file mode 100644 index 000000000000..8a31d9562ade --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_samples/update_escalation_status_of_support_ticket_for_subscription.py @@ -0,0 +1,48 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.support import SupportMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-support +# USAGE + python update_escalation_status_of_support_ticket_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 = SupportMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.support_tickets.update( + support_ticket_name="testticket", + update_support_ticket={ + "contactDetails": {"phoneNumber": "123-456-7890"}, + "directConnectEscalation": { + "azureEEStatus": "EscalationInitiated", + "reasonForEscalation": "Server is down and business is impacted", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2026-07-01/UpdateEscalationStatusOfSupportTicketForSubscription.json +if __name__ == "__main__": + main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket.py index 8108586a8a95..43668a3dfcd0 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateSeverityOfSupportTicket.json +# x-ms-original-file: 2026-07-01/UpdateSeverityOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_severity_of_support_ticket_for_subscription.py index 1afd4d1cc000..12e59034a68b 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.update( @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateSeverityOfSupportTicketForSubscription.json +# x-ms-original-file: 2026-07-01/UpdateSeverityOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket.py b/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket.py index 211d1650c782..6fbbc8a1db12 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,7 +25,7 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateStatusOfSupportTicket.json +# x-ms-original-file: 2026-07-01/UpdateStatusOfSupportTicket.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/update_status_of_support_ticket_for_subscription.py index d5d5b8b28307..2979e67cc30a 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 @@ -2,15 +2,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +25,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) response = client.support_tickets.update( @@ -39,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UpdateStatusOfSupportTicketForSubscription.json +# x-ms-original-file: 2026-07-01/UpdateStatusOfSupportTicketForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/upload_file.py b/sdk/support/azure-mgmt-support/generated_samples/upload_file.py index d5feaadbf452..9a4656eb159a 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/upload_file.py +++ b/sdk/support/azure-mgmt-support/generated_samples/upload_file.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) client.files_no_subscription.upload( @@ -42,6 +41,6 @@ def main(): ) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UploadFile.json +# x-ms-original-file: 2026-07-01/UploadFile.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py b/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py index b01005c228b6..b0db6d0a50ba 100644 --- a/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py +++ b/sdk/support/azure-mgmt-support/generated_samples/upload_file_for_subscription.py @@ -1,16 +1,15 @@ +# pylint: disable=line-too-long,useless-suppression # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python 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 +from azure.mgmt.support import SupportMgmtClient """ # PREREQUISITES @@ -27,9 +26,9 @@ def main(): - client = MicrosoftSupport( + client = SupportMgmtClient( credential=DefaultAzureCredential(), - subscription_id="132d901f-189d-4381-9214-fe68e27e05a1", + subscription_id="SUBSCRIPTION_ID", ) client.files.upload( @@ -42,6 +41,6 @@ def main(): ) -# x-ms-original-file: specification/support/resource-manager/Microsoft.Support/stable/2024-04-01/examples/UploadFileForSubscription.json +# x-ms-original-file: 2026-07-01/UploadFileForSubscription.json if __name__ == "__main__": main() diff --git a/sdk/support/azure-mgmt-support/generated_tests/conftest.py b/sdk/support/azure-mgmt-support/generated_tests/conftest.py new file mode 100644 index 000000000000..543611c56b60 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + supportmgmt_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + supportmgmt_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + supportmgmt_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + supportmgmt_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=supportmgmt_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=supportmgmt_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=supportmgmt_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=supportmgmt_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_no_subscription_operations.py new file mode 100644 index 000000000000..2b3527872b20 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_no_subscription_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtChatTranscriptsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_no_subscription_get(self, resource_group): + response = self.client.chat_transcripts_no_subscription.get( + support_ticket_name="str", + chat_transcript_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_no_subscription_list(self, resource_group): + response = self.client.chat_transcripts_no_subscription.list( + support_ticket_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_no_subscription_operations_async.py new file mode 100644 index 000000000000..2955b6dc3e80 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_no_subscription_operations_async.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtChatTranscriptsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_no_subscription_get(self, resource_group): + response = await self.client.chat_transcripts_no_subscription.get( + support_ticket_name="str", + chat_transcript_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_no_subscription_list(self, resource_group): + response = self.client.chat_transcripts_no_subscription.list( + support_ticket_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_operations.py new file mode 100644 index 000000000000..c5251241e48f --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtChatTranscriptsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_get(self, resource_group): + response = self.client.chat_transcripts.get( + support_ticket_name="str", + chat_transcript_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_chat_transcripts_list(self, resource_group): + response = self.client.chat_transcripts.list( + support_ticket_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_operations_async.py new file mode 100644 index 000000000000..2c691aaa2df9 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_chat_transcripts_operations_async.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtChatTranscriptsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_get(self, resource_group): + response = await self.client.chat_transcripts.get( + support_ticket_name="str", + chat_transcript_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_chat_transcripts_list(self, resource_group): + response = self.client.chat_transcripts.list( + support_ticket_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_no_subscription_operations.py new file mode 100644 index 000000000000..edc8b28e3782 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_no_subscription_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyProblemsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_classify_problems_no_subscription_classify_problems(self, resource_group): + response = self.client.classify_problems_no_subscription.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_no_subscription_operations_async.py new file mode 100644 index 000000000000..829856afa08e --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_no_subscription_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyProblemsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_classify_problems_no_subscription_classify_problems(self, resource_group): + response = await self.client.classify_problems_no_subscription.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_operations.py new file mode 100644 index 000000000000..6eb3a2bf25a4 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_operations.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyProblemsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_classify_problems_classify_problems(self, resource_group): + response = self.client.classify_problems.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_operations_async.py new file mode 100644 index 000000000000..59ad59f9b725 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_problems_operations_async.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyProblemsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_classify_problems_classify_problems(self, resource_group): + response = await self.client.classify_problems.classify_problems( + problem_service_name="str", + problem_classifications_classification_input={"issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_no_subscription_operations.py new file mode 100644 index 000000000000..5365b0096c5a --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_no_subscription_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyServicesNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_classify_services_no_subscription_classify_services(self, resource_group): + response = self.client.classify_services_no_subscription.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_no_subscription_operations_async.py new file mode 100644 index 000000000000..cf4cf382dea4 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_no_subscription_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyServicesNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_classify_services_no_subscription_classify_services(self, resource_group): + response = await self.client.classify_services_no_subscription.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_operations.py new file mode 100644 index 000000000000..4a62a312a1d7 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_operations.py @@ -0,0 +1,29 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_classify_services_classify_services(self, resource_group): + response = self.client.classify_services.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_operations_async.py new file mode 100644 index 000000000000..db889307b95a --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_classify_services_operations_async.py @@ -0,0 +1,30 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtClassifyServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_classify_services_classify_services(self, resource_group): + response = await self.client.classify_services.classify_services( + service_classification_request={"additionalContext": "str", "issueSummary": "str", "resourceId": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_no_subscription_operations.py new file mode 100644 index 000000000000..dc8cf157fdb3 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_no_subscription_operations.py @@ -0,0 +1,83 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtCommunicationsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_get(self, resource_group): + response = self.client.communications_no_subscription.get( + support_ticket_name="str", + communication_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_begin_create(self, resource_group): + response = self.client.communications_no_subscription.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "properties": { + "body": "str", + "subject": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "sender": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_list(self, resource_group): + response = self.client.communications_no_subscription.list( + support_ticket_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_no_subscription_check_name_availability(self, resource_group): + response = self.client.communications_no_subscription.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_no_subscription_operations_async.py new file mode 100644 index 000000000000..0fdc844a54ea --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_no_subscription_operations_async.py @@ -0,0 +1,86 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtCommunicationsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_get(self, resource_group): + response = await self.client.communications_no_subscription.get( + support_ticket_name="str", + communication_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_begin_create(self, resource_group): + response = await ( + await self.client.communications_no_subscription.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "properties": { + "body": "str", + "subject": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "sender": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_list(self, resource_group): + response = self.client.communications_no_subscription.list( + support_ticket_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_no_subscription_check_name_availability(self, resource_group): + response = await self.client.communications_no_subscription.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_operations.py new file mode 100644 index 000000000000..7e4217e90617 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_operations.py @@ -0,0 +1,83 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtCommunicationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_get(self, resource_group): + response = self.client.communications.get( + support_ticket_name="str", + communication_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_begin_create(self, resource_group): + response = self.client.communications.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "properties": { + "body": "str", + "subject": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "sender": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_list(self, resource_group): + response = self.client.communications.list( + support_ticket_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_communications_check_name_availability(self, resource_group): + response = self.client.communications.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_operations_async.py new file mode 100644 index 000000000000..ab63e6d1a58b --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_communications_operations_async.py @@ -0,0 +1,86 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtCommunicationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_get(self, resource_group): + response = await self.client.communications.get( + support_ticket_name="str", + communication_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_begin_create(self, resource_group): + response = await ( + await self.client.communications.begin_create( + support_ticket_name="str", + communication_name="str", + create_communication_parameters={ + "properties": { + "body": "str", + "subject": "str", + "communicationDirection": "str", + "communicationType": "str", + "createdDate": "2020-02-20 00:00:00", + "sender": "str", + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_list(self, resource_group): + response = self.client.communications.list( + support_ticket_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_communications_check_name_availability(self, resource_group): + response = await self.client.communications.check_name_availability( + support_ticket_name="str", + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_no_subscription_operations.py new file mode 100644 index 000000000000..549b4dce2c97 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_no_subscription_operations.py @@ -0,0 +1,39 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFileWorkspacesNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_no_subscription_get(self, resource_group): + response = self.client.file_workspaces_no_subscription.get( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_no_subscription_create(self, resource_group): + response = self.client.file_workspaces_no_subscription.create( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_no_subscription_operations_async.py new file mode 100644 index 000000000000..206e34dca3a5 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_no_subscription_operations_async.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFileWorkspacesNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_no_subscription_get(self, resource_group): + response = await self.client.file_workspaces_no_subscription.get( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_no_subscription_create(self, resource_group): + response = await self.client.file_workspaces_no_subscription.create( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_operations.py new file mode 100644 index 000000000000..5ccb5d5b010e --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_operations.py @@ -0,0 +1,39 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFileWorkspacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_get(self, resource_group): + response = self.client.file_workspaces.get( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_file_workspaces_create(self, resource_group): + response = self.client.file_workspaces.create( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_operations_async.py new file mode 100644 index 000000000000..9857885c7d3b --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_file_workspaces_operations_async.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFileWorkspacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_get(self, resource_group): + response = await self.client.file_workspaces.get( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_file_workspaces_create(self, resource_group): + response = await self.client.file_workspaces.create( + file_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_no_subscription_operations.py new file mode 100644 index 000000000000..56a9bcab0f74 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_no_subscription_operations.py @@ -0,0 +1,77 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFilesNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_get(self, resource_group): + response = self.client.files_no_subscription.get( + file_workspace_name="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_create(self, resource_group): + response = self.client.files_no_subscription.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "id": "str", + "name": "str", + "properties": {"chunkSize": 0, "createdOn": "2020-02-20 00:00:00", "fileSize": 0, "numberOfChunks": 0}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_list(self, resource_group): + response = self.client.files_no_subscription.list( + file_workspace_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_no_subscription_upload(self, resource_group): + response = self.client.files_no_subscription.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_no_subscription_operations_async.py new file mode 100644 index 000000000000..211dafca3fb4 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_no_subscription_operations_async.py @@ -0,0 +1,78 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFilesNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_get(self, resource_group): + response = await self.client.files_no_subscription.get( + file_workspace_name="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_create(self, resource_group): + response = await self.client.files_no_subscription.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "id": "str", + "name": "str", + "properties": {"chunkSize": 0, "createdOn": "2020-02-20 00:00:00", "fileSize": 0, "numberOfChunks": 0}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_list(self, resource_group): + response = self.client.files_no_subscription.list( + file_workspace_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_no_subscription_upload(self, resource_group): + response = await self.client.files_no_subscription.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_operations.py new file mode 100644 index 000000000000..23261964537f --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_operations.py @@ -0,0 +1,77 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFilesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_get(self, resource_group): + response = self.client.files.get( + file_workspace_name="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_create(self, resource_group): + response = self.client.files.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "id": "str", + "name": "str", + "properties": {"chunkSize": 0, "createdOn": "2020-02-20 00:00:00", "fileSize": 0, "numberOfChunks": 0}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_list(self, resource_group): + response = self.client.files.list( + file_workspace_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_files_upload(self, resource_group): + response = self.client.files.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_operations_async.py new file mode 100644 index 000000000000..414b6892f7e0 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_files_operations_async.py @@ -0,0 +1,78 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtFilesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_get(self, resource_group): + response = await self.client.files.get( + file_workspace_name="str", + file_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_create(self, resource_group): + response = await self.client.files.create( + file_workspace_name="str", + file_name="str", + create_file_parameters={ + "id": "str", + "name": "str", + "properties": {"chunkSize": 0, "createdOn": "2020-02-20 00:00:00", "fileSize": 0, "numberOfChunks": 0}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_list(self, resource_group): + response = self.client.files.list( + file_workspace_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_files_upload(self, resource_group): + response = await self.client.files.upload( + file_workspace_name="str", + file_name="str", + upload_file={"chunkIndex": 0, "content": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_operations.py new file mode 100644 index 000000000000..387bc2f58747 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_operations.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_operations_async.py new file mode 100644 index 000000000000..ef79afa1dd06 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_operations_async.py @@ -0,0 +1,28 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_problem_classifications_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_problem_classifications_operations.py new file mode 100644 index 000000000000..b6d3f16b5a8d --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_problem_classifications_operations.py @@ -0,0 +1,40 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtProblemClassificationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_problem_classifications_get(self, resource_group): + response = self.client.problem_classifications.get( + service_name="str", + problem_classification_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_problem_classifications_list(self, resource_group): + response = self.client.problem_classifications.list( + service_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_problem_classifications_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_problem_classifications_operations_async.py new file mode 100644 index 000000000000..62713766c7ea --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_problem_classifications_operations_async.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtProblemClassificationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_problem_classifications_get(self, resource_group): + response = await self.client.problem_classifications.get( + service_name="str", + problem_classification_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_problem_classifications_list(self, resource_group): + response = self.client.problem_classifications.list( + service_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_services_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_services_operations.py new file mode 100644 index 000000000000..1520089512e8 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_services_operations.py @@ -0,0 +1,37 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_get(self, resource_group): + response = self.client.services.get( + service_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_list(self, resource_group): + response = self.client.services.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_services_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_services_operations_async.py new file mode 100644 index 000000000000..72430416c908 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_services_operations_async.py @@ -0,0 +1,38 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_get(self, resource_group): + response = await self.client.services.get( + service_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_list(self, resource_group): + response = self.client.services.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_no_subscription_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_no_subscription_operations.py new file mode 100644 index 000000000000..58124b7d0d40 --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_no_subscription_operations.py @@ -0,0 +1,157 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtSupportTicketsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_get(self, resource_group): + response = self.client.support_tickets_no_subscription.get( + support_ticket_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_begin_create(self, resource_group): + response = self.client.support_tickets_no_subscription.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "properties": { + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "description": "str", + "problemClassificationId": "str", + "serviceId": "str", + "severity": "str", + "title": "str", + "chatConversationStatus": "str", + "communityForumPost": "str", + "createdDate": "2020-02-20 00:00:00", + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "enrollmentId": "str", + "fileWorkspaceName": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "problemClassificationDisplayName": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "status": "str", + "supportChannel": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_update(self, resource_group): + response = self.client.support_tickets_no_subscription.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_list(self, resource_group): + response = self.client.support_tickets_no_subscription.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_check_name_availability(self, resource_group): + response = self.client.support_tickets_no_subscription.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_no_subscription_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_no_subscription_operations_async.py new file mode 100644 index 000000000000..2fec7ca94c7e --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_no_subscription_operations_async.py @@ -0,0 +1,160 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtSupportTicketsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_get(self, resource_group): + response = await self.client.support_tickets_no_subscription.get( + support_ticket_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_begin_create(self, resource_group): + response = await ( + await self.client.support_tickets_no_subscription.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "properties": { + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "description": "str", + "problemClassificationId": "str", + "serviceId": "str", + "severity": "str", + "title": "str", + "chatConversationStatus": "str", + "communityForumPost": "str", + "createdDate": "2020-02-20 00:00:00", + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "enrollmentId": "str", + "fileWorkspaceName": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "problemClassificationDisplayName": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "status": "str", + "supportChannel": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_update(self, resource_group): + response = await self.client.support_tickets_no_subscription.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_list(self, resource_group): + response = self.client.support_tickets_no_subscription.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_check_name_availability(self, resource_group): + response = await self.client.support_tickets_no_subscription.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_operations.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_operations.py new file mode 100644 index 000000000000..f4a2fa4a51ee --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_operations.py @@ -0,0 +1,167 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtSupportTicketsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_get(self, resource_group): + response = self.client.support_tickets.get( + support_ticket_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_begin_create(self, resource_group): + response = self.client.support_tickets.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "properties": { + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "description": "str", + "problemClassificationId": "str", + "serviceId": "str", + "severity": "str", + "title": "str", + "chatConversationStatus": "str", + "communityForumPost": "str", + "createdDate": "2020-02-20 00:00:00", + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "enrollmentId": "str", + "fileWorkspaceName": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "problemClassificationDisplayName": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "status": "str", + "supportChannel": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_update(self, resource_group): + response = self.client.support_tickets.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_list(self, resource_group): + response = self.client.support_tickets.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_look_up_resource_id(self, resource_group): + response = self.client.support_tickets.look_up_resource_id( + look_up_resource_id_request={"identifier": "str", "type": "Microsoft.Support/supportTickets"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_check_name_availability(self, resource_group): + response = self.client.support_tickets.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_operations_async.py b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_operations_async.py new file mode 100644 index 000000000000..e56407a435ab --- /dev/null +++ b/sdk/support/azure-mgmt-support/generated_tests/test_support_mgmt_support_tickets_operations_async.py @@ -0,0 +1,170 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestSupportMgmtSupportTicketsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_get(self, resource_group): + response = await self.client.support_tickets.get( + support_ticket_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_begin_create(self, resource_group): + response = await ( + await self.client.support_tickets.begin_create( + support_ticket_name="str", + create_support_ticket_parameters={ + "properties": { + "advancedDiagnosticConsent": "str", + "contactDetails": { + "country": "str", + "firstName": "str", + "lastName": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + "additionalEmailAddresses": ["str"], + "phoneNumber": "str", + }, + "description": "str", + "problemClassificationId": "str", + "serviceId": "str", + "severity": "str", + "title": "str", + "chatConversationStatus": "str", + "communityForumPost": "str", + "createdDate": "2020-02-20 00:00:00", + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "enrollmentId": "str", + "fileWorkspaceName": "str", + "isTemporaryTicket": "str", + "modifiedDate": "2020-02-20 00:00:00", + "problemClassificationDisplayName": "str", + "problemScopingQuestions": "str", + "problemStartTime": "2020-02-20 00:00:00", + "quotaTicketDetails": { + "quotaChangeRequestSubType": "str", + "quotaChangeRequestVersion": "str", + "quotaChangeRequests": [{"payload": "str", "region": "str"}], + }, + "require24X7Response": bool, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "serviceDisplayName": "str", + "serviceLevelAgreement": { + "expirationTime": "2020-02-20 00:00:00", + "slaMinutes": 0, + "startTime": "2020-02-20 00:00:00", + }, + "status": "str", + "supportChannel": "str", + "supportEngineer": {"emailAddress": "str"}, + "supportPlanDisplayName": "str", + "supportPlanId": "str", + "supportPlanType": "str", + "supportTicketId": "str", + "technicalTicketDetails": {"resourceId": "str"}, + }, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_update(self, resource_group): + response = await self.client.support_tickets.update( + support_ticket_name="str", + update_support_ticket={ + "advancedDiagnosticConsent": "str", + "contactDetails": { + "additionalEmailAddresses": ["str"], + "country": "str", + "firstName": "str", + "lastName": "str", + "phoneNumber": "str", + "preferredContactMethod": "str", + "preferredSupportLanguage": "str", + "preferredTimeZone": "str", + "primaryEmailAddress": "str", + }, + "directConnectEscalation": { + "allowedSeverities": ["str"], + "azureEEStatus": "str", + "reasonForEscalation": "str", + }, + "secondaryConsent": [{"type": "str", "userConsent": "str"}], + "severity": "str", + "status": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_list(self, resource_group): + response = self.client.support_tickets.list() + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_look_up_resource_id(self, resource_group): + response = await self.client.support_tickets.look_up_resource_id( + look_up_resource_id_request={"identifier": "str", "type": "Microsoft.Support/supportTickets"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_check_name_availability(self, resource_group): + response = await self.client.support_tickets.check_name_availability( + check_name_availability_input={"name": "str", "type": "str"}, + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/support/azure-mgmt-support/pyproject.toml b/sdk/support/azure-mgmt-support/pyproject.toml index 540da07d41af..8284c5083272 100644 --- a/sdk/support/azure-mgmt-support/pyproject.toml +++ b/sdk/support/azure-mgmt-support/pyproject.toml @@ -1,6 +1,88 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-support" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Support Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", +] +requires-python = ">=3.10" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.support._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-support" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Support Management" +package_doc_id = "" +is_stable = true +is_arm = true +title = "SupportMgmtClient" +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/support/azure-mgmt-support/sdk_packaging.toml b/sdk/support/azure-mgmt-support/sdk_packaging.toml deleted file mode 100644 index b17ab7dba4a0..000000000000 --- a/sdk/support/azure-mgmt-support/sdk_packaging.toml +++ /dev/null @@ -1,8 +0,0 @@ -[packaging] -package_name = "azure-mgmt-support" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Support Management" -package_doc_id = "" -is_stable = true -is_arm = true -title = "MicrosoftSupport" diff --git a/sdk/support/azure-mgmt-support/setup.py b/sdk/support/azure-mgmt-support/setup.py deleted file mode 100644 index 4aafdd3ea16f..000000000000 --- a/sdk/support/azure-mgmt-support/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-support" -PACKAGE_PPRINT_NAME = "Support Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", - ], - python_requires=">=3.8", -) diff --git a/sdk/support/azure-mgmt-support/tests/conftest.py b/sdk/support/azure-mgmt-support/tests/conftest.py new file mode 100644 index 000000000000..49d6548bd21c --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/conftest.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import os +import pytest +from dotenv import load_dotenv +from devtools_testutils import ( + test_proxy, + add_general_regex_sanitizer, + add_body_key_sanitizer, + add_header_regex_sanitizer, +) + +load_dotenv() + + +# For security, please avoid record sensitive identity information in recordings +@pytest.fixture(scope="session", autouse=True) +def add_sanitizers(test_proxy): + support_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + support_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + support_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + support_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=support_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=support_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=support_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=support_client_secret, value="00000000-0000-0000-0000-000000000000") + + add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") + add_header_regex_sanitizer(key="Cookie", value="cookie;") + add_body_key_sanitizer(json_path="$..access_token", value="access_token") diff --git a/sdk/support/azure-mgmt-support/tests/disable_test_cli_mgmt_support.py b/sdk/support/azure-mgmt-support/tests/disable_test_cli_mgmt_support.py index 605209497aa0..d936417933be 100644 --- a/sdk/support/azure-mgmt-support/tests/disable_test_cli_mgmt_support.py +++ b/sdk/support/azure-mgmt-support/tests/disable_test_cli_mgmt_support.py @@ -1,10 +1,11 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 -#------------------------------------------------------------------------- +# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. -#-------------------------------------------------------------------------- +# -------------------------------------------------------------------------- # TEST SCENARIO COVERAGE @@ -21,16 +22,15 @@ import azure.mgmt.support from devtools_testutils import AzureMgmtTestCase, ResourceGroupPreparer -AZURE_LOCATION = 'eastus' +AZURE_LOCATION = "eastus" + class MgmtMicrosoftSupportTest(AzureMgmtTestCase): def setUp(self): super(MgmtMicrosoftSupportTest, self).setUp() - self.mgmt_client = self.create_mgmt_client( - azure.mgmt.support.MicrosoftSupport - ) - + self.mgmt_client = self.create_mgmt_client(azure.mgmt.support.MicrosoftSupport) + @unittest.skip("skip test") @ResourceGroupPreparer(location=AZURE_LOCATION) def test_support(self, resource_group): @@ -46,431 +46,397 @@ def test_support(self, resource_group): # /SupportTickets/put/Create a ticket to request Quota increase for Low-priority cores for a Batch account[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "Account", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"AccountName\":\"test\",\"NewLimit\":200,\"Type\":\"LowPriority\"}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "Account", + "quota_change_requests": [ + {"region": "EastUS", "payload": '{"AccountName":"test","NewLimit":200,"Type":"LowPriority"}'} + ], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for Servers for Azure Synapse Analytics[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_datawarehouse_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "Servers", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"NewLimit\":200}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_datawarehouse_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "Servers", + "quota_change_requests": [{"region": "EastUS", "payload": '{"NewLimit":200}'}], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for DTUs for Azure Synapse Analytics[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_datawarehouse_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "DTUs", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"ServerName\":\"testserver\",\"NewLimit\":54000}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_datawarehouse_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "DTUs", + "quota_change_requests": [ + {"region": "EastUS", "payload": '{"ServerName":"testserver","NewLimit":54000}'} + ], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for Servers for SQL Database[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_database_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "Servers", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"NewLimit\":200}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_database_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "Servers", + "quota_change_requests": [{"region": "EastUS", "payload": '{"NewLimit":200}'}], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for DTUs for SQL Database[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_database_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "DTUs", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"ServerName\":\"testserver\",\"NewLimit\":54000}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/sql_database_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "DTUs", + "quota_change_requests": [ + {"region": "EastUS", "payload": '{"ServerName":"testserver","NewLimit":54000}'} + ], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for specific VM family cores for Machine Learning service[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/machine_learning_service_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "BatchAml", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"VMFamily\":\"standardA0_A7Family\",\"NewLimit\":200,\"Type\":\"Dedicated\"}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/machine_learning_service_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "BatchAml", + "quota_change_requests": [ + { + "region": "EastUS", + "payload": '{"VMFamily":"standardA0_A7Family","NewLimit":200,"Type":"Dedicated"}', + } + ], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for Active Jobs and Job Schedules for a Batch account[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "Account", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"AccountName\":\"test\",\"NewLimit\":200,\"Type\":\"Jobs\"}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "Account", + "quota_change_requests": [ + {"region": "EastUS", "payload": '{"AccountName":"test","NewLimit":200,"Type":"Jobs"}'} + ], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for Pools for a Batch account[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "Account", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"AccountName\":\"test\",\"NewLimit\":200,\"Type\":\"Pools\"}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "Account", + "quota_change_requests": [ + {"region": "EastUS", "payload": '{"AccountName":"test","NewLimit":200,"Type":"Pools"}'} + ], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for specific VM family cores for a Batch account[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "Account", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"AccountName\":\"test\",\"VMFamily\":\"standardA0_A7Family\",\"NewLimit\":200,\"Type\":\"Dedicated\"}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "Account", + "quota_change_requests": [ + { + "region": "EastUS", + "payload": '{"AccountName":"test","VMFamily":"standardA0_A7Family","NewLimit":200,"Type":"Dedicated"}', + } + ], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket for Billing related issues[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/billing_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/billing_service_guid/problemClassifications/billing_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - } + "service_id": "/providers/Microsoft.Support/services/billing_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/billing_service_guid/problemClassifications/billing_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket for Subscription Management related issues[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/subscription_management_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/subscription_management_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - } + "service_id": "/providers/Microsoft.Support/services/subscription_management_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/subscription_management_service_guid/problemClassifications/subscription_management_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for Low-priority cores for Machine Learning service[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/machine_learning_service_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "BatchAml", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"NewLimit\":200,\"Type\":\"LowPriority\"}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/machine_learning_service_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "BatchAml", + "quota_change_requests": [{"region": "EastUS", "payload": '{"NewLimit":200,"Type":"LowPriority"}'}], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket for Technical issue related to a specific resource[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/cddd3eb5-1830-b494-44fd-782f691479dc", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid/problemClassifications/problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "technical_ticket_details": { - "resource_id": "/subscriptions/" + SUBSCRIPTION_ID + "/resourceGroups/" + RESOURCE_GROUP + "/providers/Microsoft.Compute/virtualMachines/" + VIRTUAL_MACHINE_NAME + "" - } + "service_id": "/providers/Microsoft.Support/services/cddd3eb5-1830-b494-44fd-782f691479dc", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/virtual_machine_running_linux_service_guid/problemClassifications/problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "technical_ticket_details": { + "resource_id": "/subscriptions/" + + SUBSCRIPTION_ID + + "/resourceGroups/" + + RESOURCE_GROUP + + "/providers/Microsoft.Compute/virtualMachines/" + + VIRTUAL_MACHINE_NAME + + "" + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for Compute VM Cores[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/cores_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"SKU\":\"DSv3 Series\",\"NewLimit\":104}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/cores_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_requests": [{"region": "EastUS", "payload": '{"SKU":"DSv3 Series","NewLimit":104}'}], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /SupportTickets/put/Create a ticket to request Quota increase for Batch accounts for a subscription[put] BODY = { - "service_id": "/providers/Microsoft.Support/services/quota_service_guid", - "title": "my title", - "description": "my description", - "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", - "severity": "moderate", - "contact_details": { - "first_name": "abc", - "last_name": "xyz", - "primary_email_address": "abc@contoso.com", - "preferred_contact_method": "email", - "preferred_time_zone": "Pacific Standard Time", - "preferred_support_language": "en-US", - "country": "usa" - }, - "quota_ticket_details": { - "quota_change_request_version": "1.0", - "quota_change_request_sub_type": "Subscription", - "quota_change_requests": [ - { - "region": "EastUS", - "payload": "{\"NewLimit\":200,\"Type\":\"Account\"}" - } - ] - } + "service_id": "/providers/Microsoft.Support/services/quota_service_guid", + "title": "my title", + "description": "my description", + "problem_classification_id": "/providers/Microsoft.Support/services/quota_service_guid/problemClassifications/batch_problemClassification_guid", + "severity": "moderate", + "contact_details": { + "first_name": "abc", + "last_name": "xyz", + "primary_email_address": "abc@contoso.com", + "preferred_contact_method": "email", + "preferred_time_zone": "Pacific Standard Time", + "preferred_support_language": "en-US", + "country": "usa", + }, + "quota_ticket_details": { + "quota_change_request_version": "1.0", + "quota_change_request_sub_type": "Subscription", + "quota_change_requests": [{"region": "EastUS", "payload": '{"NewLimit":200,"Type":"Account"}'}], + }, } # result = self.mgmt_client.support_tickets.create(support_ticket_name=SUPPORT_TICKET_NAME, create_support_ticket_parameters=BODY) # result = result.result() # /Communications/put/AddCommunicationToSubscriptionTicket[put] BODY = { - "subject": "This is a test message from a customer!", - "body": "This is a test message from a customer!", - "sender": "user@contoso.com" + "subject": "This is a test message from a customer!", + "body": "This is a test message from a customer!", + "sender": "user@contoso.com", } # result = self.mgmt_client.communications.create(support_ticket_name=SUPPORT_TICKET_NAME, communication_name=COMMUNICATION_NAME, create_communication_parameters=BODY) # result = result.result() @@ -488,7 +454,9 @@ def test_support(self, resource_group): # result = self.mgmt_client.communications.list(support_ticket_name=SUPPORT_TICKET_NAME, filter="communicationType eq 'web' and createdDate ge 2020-03-10T22:08:51Z") # /ProblemClassifications/get/Gets details of problemClassification for Azure service[get] - result = self.mgmt_client.problem_classifications.get(service_name=SERVICE_NAME, problem_classification_name=PROBLEM_CLASSIFICATION_NAME) + result = self.mgmt_client.problem_classifications.get( + service_name=SERVICE_NAME, problem_classification_name=PROBLEM_CLASSIFICATION_NAME + ) # /SupportTickets/get/Get details of a subscription ticket[get] # result = self.mgmt_client.support_tickets.get(support_ticket_name=SUPPORT_TICKET_NAME) @@ -500,49 +468,48 @@ def test_support(self, resource_group): result = self.mgmt_client.problem_classifications.list(service_name=SERVICE_NAME) # /SupportTickets/get/List support tickets created on or after a certain date and in open state for a subscription[get] - result = self.mgmt_client.support_tickets.list(filter="createdDate ge 2020-03-10T22:08:51Z and status eq 'Open'") + result = self.mgmt_client.support_tickets.list( + filter="createdDate ge 2020-03-10T22:08:51Z and status eq 'Open'" + ) # /Services/get/Gets list of services for which a support ticket can be created[get] result = self.mgmt_client.services.list() # /Communications/post/Checks whether name is available for Communication resource[post] - result = self.mgmt_client.communications.check_name_availability(support_ticket_name=SUPPORT_TICKET_NAME, name="sampleName", type="Microsoft.Support/communications") + result = self.mgmt_client.communications.check_name_availability( + support_ticket_name=SUPPORT_TICKET_NAME, name="sampleName", type="Microsoft.Support/communications" + ) # /SupportTickets/patch/Update contact details of a support ticket[patch] BODY = { - "contact_details": { - "first_name": "first name", - "last_name": "last name", - "preferred_contact_method": "email", - "primary_email_address": "test.name@contoso.com", - "additional_email_addresses": [ - "tname@contoso.com", - "teamtest@contoso.com" - ], - "phone_number": "123-456-7890", - "preferred_time_zone": "Pacific Standard Time", - "country": "USA", - "preferred_support_language": "en-US" - } + "contact_details": { + "first_name": "first name", + "last_name": "last name", + "preferred_contact_method": "email", + "primary_email_address": "test.name@contoso.com", + "additional_email_addresses": ["tname@contoso.com", "teamtest@contoso.com"], + "phone_number": "123-456-7890", + "preferred_time_zone": "Pacific Standard Time", + "country": "USA", + "preferred_support_language": "en-US", + } } # result = self.mgmt_client.support_tickets.update(support_ticket_name=SUPPORT_TICKET_NAME, update_support_ticket=BODY) # /SupportTickets/patch/Update severity of a support ticket[patch] - BODY = { - "severity": "critical" - } + BODY = {"severity": "critical"} # result = self.mgmt_client.support_tickets.update(support_ticket_name=SUPPORT_TICKET_NAME, update_support_ticket=BODY) # /SupportTickets/patch/Update status of a support ticket[patch] - BODY = { - "status": "closed" - } + BODY = {"status": "closed"} # result = self.mgmt_client.support_tickets.update(support_ticket_name=SUPPORT_TICKET_NAME, update_support_ticket=BODY) # /SupportTickets/post/Checks whether name is available for SupportTicket resource[post] - result = self.mgmt_client.support_tickets.check_name_availability(name="sampleName", type="Microsoft.Support/supportTickets") + result = self.mgmt_client.support_tickets.check_name_availability( + name="sampleName", type="Microsoft.Support/supportTickets" + ) -#------------------------------------------------------------------------------ -if __name__ == '__main__': +# ------------------------------------------------------------------------------ +if __name__ == "__main__": unittest.main() diff --git a/sdk/support/azure-mgmt-support/tests/test_support_operations_async_test.py b/sdk/support/azure-mgmt-support/tests/test_support_operations_async_test.py new file mode 100644 index 000000000000..b668cb05aa68 --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_operations_async_test.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r async for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tests/test_support_operations_test.py b/sdk/support/azure-mgmt-support/tests/test_support_operations_test.py new file mode 100644 index 000000000000..e53dbc0aaf9b --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_operations_test.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_operations_list(self, resource_group): + response = self.client.operations.list() + result = [r for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tests/test_support_services_operations_async_test.py b/sdk/support/azure-mgmt-support/tests/test_support_services_operations_async_test.py new file mode 100644 index 000000000000..449630e27b05 --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_services_operations_async_test.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportServicesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_services_list(self, resource_group): + response = self.client.services.list() + result = [r async for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tests/test_support_services_operations_test.py b/sdk/support/azure-mgmt-support/tests/test_support_services_operations_test.py new file mode 100644 index 000000000000..009f27e4a86e --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_services_operations_test.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportServicesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_services_list(self, resource_group): + response = self.client.services.list() + result = [r for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_no_subscription_operations_async_test.py b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_no_subscription_operations_async_test.py new file mode 100644 index 000000000000..41868d3fb42e --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_no_subscription_operations_async_test.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportSupportTicketsNoSubscriptionOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_no_subscription_list(self, resource_group): + response = self.client.support_tickets_no_subscription.list() + result = [r async for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_no_subscription_operations_test.py b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_no_subscription_operations_test.py new file mode 100644 index 000000000000..b26c2379cfe9 --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_no_subscription_operations_test.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportSupportTicketsNoSubscriptionOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_no_subscription_list(self, resource_group): + response = self.client.support_tickets_no_subscription.list() + result = [r for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_operations_async_test.py b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_operations_async_test.py new file mode 100644 index 000000000000..b880cb46b632 --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_operations_async_test.py @@ -0,0 +1,27 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support.aio import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportSupportTicketsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_support_tickets_list(self, resource_group): + response = self.client.support_tickets.list() + result = [r async for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_operations_test.py b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_operations_test.py new file mode 100644 index 000000000000..01a4d758c92c --- /dev/null +++ b/sdk/support/azure-mgmt-support/tests/test_support_support_tickets_operations_test.py @@ -0,0 +1,26 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.support import SupportMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.live_test_only +class TestSupportSupportTicketsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(SupportMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_support_tickets_list(self, resource_group): + response = self.client.support_tickets.list() + result = [r for r in response] + assert len(result) diff --git a/sdk/support/azure-mgmt-support/tsp-location.yaml b/sdk/support/azure-mgmt-support/tsp-location.yaml new file mode 100644 index 000000000000..9e1f52701e18 --- /dev/null +++ b/sdk/support/azure-mgmt-support/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/support/resource-manager/Microsoft.Support/Support +commit: 3de4ed97d8bf726aa7fb8dea311a5a7d5ec59730 +repo: Azure/azure-rest-api-specs +additionalDirectories: