diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json index 64ddb3ce1e0a..e5c7b49eff3e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "2b56c8a3da0e04aea6f6d80a9ac04741d1ae5904", + "commit": "1880c646609cdd627d5c72f255335b4d4048cbcc", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/desktopvirtualization/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py index fcebd4b56540..5173b7af3491 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['DesktopVirtualizationAPIClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py index ffa93f1c794f..e0016c88a2cb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class DesktopVirtualizationAPIClientConfiguration(Configuration): +class DesktopVirtualizationAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DesktopVirtualizationAPIClient. Note that all parameters used to create this instance are saved as instance @@ -31,24 +29,28 @@ class DesktopVirtualizationAPIClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-02-10-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(DesktopVirtualizationAPIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DesktopVirtualizationAPIClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-03-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-desktopvirtualization/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py index 40177dec69db..59beb13b1a58 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py @@ -6,138 +6,122 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import DesktopVirtualizationAPIClientConfiguration -from .operations import Operations -from .operations import WorkspacesOperations -from .operations import ScalingPlansOperations -from .operations import ApplicationGroupsOperations -from .operations import StartMenuItemsOperations -from .operations import ApplicationsOperations -from .operations import DesktopsOperations -from .operations import HostPoolsOperations -from .operations import UserSessionsOperations -from .operations import SessionHostsOperations -from .operations import MSIXPackagesOperations -from .operations import MsixImagesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations from . import models +from ._configuration import DesktopVirtualizationAPIClientConfiguration +from .operations import ApplicationGroupsOperations, ApplicationsOperations, DesktopsOperations, HostPoolsOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ScalingPlansOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, WorkspacesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class DesktopVirtualizationAPIClient(object): +class DesktopVirtualizationAPIClient: # pylint: disable=too-many-instance-attributes """DesktopVirtualizationAPIClient. :ivar operations: Operations operations - :vartype operations: desktop_virtualization_api_client.operations.Operations + :vartype operations: azure.mgmt.desktopvirtualization.operations.Operations :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: desktop_virtualization_api_client.operations.WorkspacesOperations + :vartype workspaces: azure.mgmt.desktopvirtualization.operations.WorkspacesOperations :ivar scaling_plans: ScalingPlansOperations operations - :vartype scaling_plans: desktop_virtualization_api_client.operations.ScalingPlansOperations + :vartype scaling_plans: azure.mgmt.desktopvirtualization.operations.ScalingPlansOperations :ivar application_groups: ApplicationGroupsOperations operations - :vartype application_groups: desktop_virtualization_api_client.operations.ApplicationGroupsOperations + :vartype application_groups: + azure.mgmt.desktopvirtualization.operations.ApplicationGroupsOperations :ivar start_menu_items: StartMenuItemsOperations operations - :vartype start_menu_items: desktop_virtualization_api_client.operations.StartMenuItemsOperations + :vartype start_menu_items: azure.mgmt.desktopvirtualization.operations.StartMenuItemsOperations :ivar applications: ApplicationsOperations operations - :vartype applications: desktop_virtualization_api_client.operations.ApplicationsOperations + :vartype applications: azure.mgmt.desktopvirtualization.operations.ApplicationsOperations :ivar desktops: DesktopsOperations operations - :vartype desktops: desktop_virtualization_api_client.operations.DesktopsOperations + :vartype desktops: azure.mgmt.desktopvirtualization.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations - :vartype host_pools: desktop_virtualization_api_client.operations.HostPoolsOperations + :vartype host_pools: azure.mgmt.desktopvirtualization.operations.HostPoolsOperations :ivar user_sessions: UserSessionsOperations operations - :vartype user_sessions: desktop_virtualization_api_client.operations.UserSessionsOperations + :vartype user_sessions: azure.mgmt.desktopvirtualization.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations - :vartype session_hosts: desktop_virtualization_api_client.operations.SessionHostsOperations + :vartype session_hosts: azure.mgmt.desktopvirtualization.operations.SessionHostsOperations :ivar msix_packages: MSIXPackagesOperations operations - :vartype msix_packages: desktop_virtualization_api_client.operations.MSIXPackagesOperations + :vartype msix_packages: azure.mgmt.desktopvirtualization.operations.MSIXPackagesOperations :ivar msix_images: MsixImagesOperations operations - :vartype msix_images: desktop_virtualization_api_client.operations.MsixImagesOperations + :vartype msix_images: azure.mgmt.desktopvirtualization.operations.MsixImagesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: desktop_virtualization_api_client.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.desktopvirtualization.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: desktop_virtualization_api_client.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.desktopvirtualization.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-02-10-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = DesktopVirtualizationAPIClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = DesktopVirtualizationAPIClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scaling_plans = ScalingPlansOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application_groups = ApplicationGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.start_menu_items = StartMenuItemsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.desktops = DesktopsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.host_pools = HostPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_sessions = UserSessionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.session_hosts = SessionHostsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.msix_packages = MSIXPackagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.msix_images = MsixImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.scaling_plans = ScalingPlansOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_groups = ApplicationGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.start_menu_items = StartMenuItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) + self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json index 904a9e59c437..14361ed94dbb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-09-03-preview", - "total_api_version_list": ["2021-09-03-preview"], + "chosen_version": "2022-02-10-preview", + "total_api_version_list": ["2022-02-10-preview"], "client": { "name": "DesktopVirtualizationAPIClient", "filename": "_desktop_virtualization_api_client", "description": "DesktopVirtualizationAPIClient.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": false, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DesktopVirtualizationAPIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DesktopVirtualizationAPIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DesktopVirtualizationAPIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DesktopVirtualizationAPIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_patch.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_patch.py @@ -0,0 +1,31 @@ +# 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. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_vendor.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py index 3160c7b3c306..9058f3f51809 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py @@ -8,3 +8,8 @@ from ._desktop_virtualization_api_client import DesktopVirtualizationAPIClient __all__ = ['DesktopVirtualizationAPIClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py index b3c5015744c4..339677626592 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class DesktopVirtualizationAPIClientConfiguration(Configuration): +class DesktopVirtualizationAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for DesktopVirtualizationAPIClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class DesktopVirtualizationAPIClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-02-10-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +40,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(DesktopVirtualizationAPIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(DesktopVirtualizationAPIClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-03-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-desktopvirtualization/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +69,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py index f0b1d0e9141c..71cdc2f3e4b3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py @@ -6,134 +6,123 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import DesktopVirtualizationAPIClientConfiguration -from .operations import Operations -from .operations import WorkspacesOperations -from .operations import ScalingPlansOperations -from .operations import ApplicationGroupsOperations -from .operations import StartMenuItemsOperations -from .operations import ApplicationsOperations -from .operations import DesktopsOperations -from .operations import HostPoolsOperations -from .operations import UserSessionsOperations -from .operations import SessionHostsOperations -from .operations import MSIXPackagesOperations -from .operations import MsixImagesOperations -from .operations import PrivateEndpointConnectionsOperations -from .operations import PrivateLinkResourcesOperations from .. import models +from ._configuration import DesktopVirtualizationAPIClientConfiguration +from .operations import ApplicationGroupsOperations, ApplicationsOperations, DesktopsOperations, HostPoolsOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, PrivateEndpointConnectionsOperations, PrivateLinkResourcesOperations, ScalingPlansOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, WorkspacesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class DesktopVirtualizationAPIClient(object): +class DesktopVirtualizationAPIClient: # pylint: disable=too-many-instance-attributes """DesktopVirtualizationAPIClient. :ivar operations: Operations operations - :vartype operations: desktop_virtualization_api_client.aio.operations.Operations + :vartype operations: azure.mgmt.desktopvirtualization.aio.operations.Operations :ivar workspaces: WorkspacesOperations operations - :vartype workspaces: desktop_virtualization_api_client.aio.operations.WorkspacesOperations + :vartype workspaces: azure.mgmt.desktopvirtualization.aio.operations.WorkspacesOperations :ivar scaling_plans: ScalingPlansOperations operations - :vartype scaling_plans: desktop_virtualization_api_client.aio.operations.ScalingPlansOperations + :vartype scaling_plans: azure.mgmt.desktopvirtualization.aio.operations.ScalingPlansOperations :ivar application_groups: ApplicationGroupsOperations operations - :vartype application_groups: desktop_virtualization_api_client.aio.operations.ApplicationGroupsOperations + :vartype application_groups: + azure.mgmt.desktopvirtualization.aio.operations.ApplicationGroupsOperations :ivar start_menu_items: StartMenuItemsOperations operations - :vartype start_menu_items: desktop_virtualization_api_client.aio.operations.StartMenuItemsOperations + :vartype start_menu_items: + azure.mgmt.desktopvirtualization.aio.operations.StartMenuItemsOperations :ivar applications: ApplicationsOperations operations - :vartype applications: desktop_virtualization_api_client.aio.operations.ApplicationsOperations + :vartype applications: azure.mgmt.desktopvirtualization.aio.operations.ApplicationsOperations :ivar desktops: DesktopsOperations operations - :vartype desktops: desktop_virtualization_api_client.aio.operations.DesktopsOperations + :vartype desktops: azure.mgmt.desktopvirtualization.aio.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations - :vartype host_pools: desktop_virtualization_api_client.aio.operations.HostPoolsOperations + :vartype host_pools: azure.mgmt.desktopvirtualization.aio.operations.HostPoolsOperations :ivar user_sessions: UserSessionsOperations operations - :vartype user_sessions: desktop_virtualization_api_client.aio.operations.UserSessionsOperations + :vartype user_sessions: azure.mgmt.desktopvirtualization.aio.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations - :vartype session_hosts: desktop_virtualization_api_client.aio.operations.SessionHostsOperations + :vartype session_hosts: azure.mgmt.desktopvirtualization.aio.operations.SessionHostsOperations :ivar msix_packages: MSIXPackagesOperations operations - :vartype msix_packages: desktop_virtualization_api_client.aio.operations.MSIXPackagesOperations + :vartype msix_packages: azure.mgmt.desktopvirtualization.aio.operations.MSIXPackagesOperations :ivar msix_images: MsixImagesOperations operations - :vartype msix_images: desktop_virtualization_api_client.aio.operations.MsixImagesOperations + :vartype msix_images: azure.mgmt.desktopvirtualization.aio.operations.MsixImagesOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations - :vartype private_endpoint_connections: desktop_virtualization_api_client.aio.operations.PrivateEndpointConnectionsOperations + :vartype private_endpoint_connections: + azure.mgmt.desktopvirtualization.aio.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations - :vartype private_link_resources: desktop_virtualization_api_client.aio.operations.PrivateLinkResourcesOperations + :vartype private_link_resources: + azure.mgmt.desktopvirtualization.aio.operations.PrivateLinkResourcesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. :type subscription_id: str - :param str base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-02-10-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = DesktopVirtualizationAPIClientConfiguration(credential, subscription_id, **kwargs) + self._config = DesktopVirtualizationAPIClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.scaling_plans = ScalingPlansOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_groups = ApplicationGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.start_menu_items = StartMenuItemsOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.desktops = DesktopsOperations(self._client, self._config, self._serialize, self._deserialize) + self.host_pools = HostPoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.user_sessions = UserSessionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.session_hosts = SessionHostsOperations(self._client, self._config, self._serialize, self._deserialize) + self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.msix_images = MsixImagesOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations(self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.workspaces = WorkspacesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.scaling_plans = ScalingPlansOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application_groups = ApplicationGroupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.start_menu_items = StartMenuItemsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.desktops = DesktopsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.host_pools = HostPoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.user_sessions = UserSessionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.session_hosts = SessionHostsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.msix_packages = MSIXPackagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.msix_images = MsixImagesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.private_link_resources = PrivateLinkResourcesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_patch.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_patch.py @@ -0,0 +1,31 @@ +# 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. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py index 46ebddcc524f..52154463f7ac 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._application_groups_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class ApplicationGroupsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -55,7 +60,7 @@ async def get( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] @@ -63,28 +68,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,8 +99,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -113,10 +118,10 @@ async def create_or_update( :param application_group_name: The name of the application group. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. - :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroup + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] @@ -124,33 +129,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(application_group, 'ApplicationGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(application_group, 'ApplicationGroup') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -167,9 +168,12 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore - async def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, @@ -191,28 +195,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -222,8 +223,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -237,11 +240,12 @@ async def update( :type resource_group_name: str :param application_group_name: The name of the application group. :type application_group_name: str - :param application_group: Object containing ApplicationGroup definitions. - :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroupPatch + :param application_group: Object containing ApplicationGroup definitions. Default value is + None. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] @@ -249,36 +253,32 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if application_group is not None: - body_content = self._serialize.body(application_group, 'ApplicationGroupPatch') + _json = self._serialize.body(application_group, 'ApplicationGroupPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,8 +291,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -304,49 +307,51 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param filter: OData filter expression. Valid properties for filtering are - applicationGroupType. + applicationGroupType. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :return: An iterator like instance of either ApplicationGroupList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + 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('ApplicationGroupList', pipeline_response) + deserialized = self._deserialize("ApplicationGroupList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -355,7 +360,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -364,11 +373,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups"} # type: ignore + @distributed_trace def list_by_subscription( self, filter: Optional[str] = None, @@ -377,48 +388,49 @@ def list_by_subscription( """List applicationGroups in subscription. :param filter: OData filter expression. Valid properties for filtering are - applicationGroupType. + applicationGroupType. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :return: An iterator like instance of either ApplicationGroupList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + 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('ApplicationGroupList', pipeline_response) + deserialized = self._deserialize("ApplicationGroupList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -427,7 +439,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -436,7 +452,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py index e3ae135cc559..c4d63afcab85 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._applications_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class ApplicationsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,7 @@ async def get( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Application + :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] @@ -66,29 +71,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -120,10 +125,10 @@ async def create_or_update( :param application_name: The name of the application within the specified application group. :type application_name: str :param application: Object containing Application definitions. - :type application: ~desktop_virtualization_api_client.models.Application + :type application: ~azure.mgmt.desktopvirtualization.models.Application :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Application + :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] @@ -131,34 +136,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(application, 'Application') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(application, 'Application') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -175,9 +176,12 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore - async def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, application_group_name: str, @@ -202,29 +206,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -234,8 +235,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -252,11 +255,11 @@ async def update( :type application_group_name: str :param application_name: The name of the application within the specified application group. :type application_name: str - :param application: Object containing Application definitions. - :type application: ~desktop_virtualization_api_client.models.ApplicationPatch + :param application: Object containing Application definitions. Default value is None. + :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Application + :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] @@ -264,37 +267,33 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if application is not None: - body_content = self._serialize.body(application, 'ApplicationPatch') + _json = self._serialize.body(application, 'ApplicationPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -307,8 +306,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def list( self, resource_group_name: str, @@ -323,44 +325,46 @@ def list( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ApplicationList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('ApplicationList', pipeline_response) + deserialized = self._deserialize("ApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -369,7 +373,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,7 +386,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py index 8fe2d9073f00..5ede934b17d8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._desktops_operations import build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class DesktopsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,7 @@ async def get( :type desktop_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Desktop + :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] @@ -66,29 +71,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + desktop_name=desktop_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,8 +103,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}"} # type: ignore + + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -119,11 +124,11 @@ async def update( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. :type desktop_name: str - :param desktop: Object containing Desktop definitions. - :type desktop: ~desktop_virtualization_api_client.models.DesktopPatch + :param desktop: Object containing Desktop definitions. Default value is None. + :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Desktop + :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] @@ -131,37 +136,33 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if desktop is not None: - body_content = self._serialize.body(desktop, 'DesktopPatch') + _json = self._serialize.body(desktop, 'DesktopPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + desktop_name=desktop_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,8 +175,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}"} # type: ignore + + + @distributed_trace def list( self, resource_group_name: str, @@ -190,44 +194,46 @@ def list( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DesktopList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.DesktopList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.DesktopList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DesktopList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('DesktopList', pipeline_response) + deserialized = self._deserialize("DesktopList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -236,7 +242,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -245,7 +255,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py index 1af3c03a2e92..73802ab9c958 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._host_pools_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_retrieve_registration_token_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class HostPoolsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -55,7 +60,7 @@ async def get( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.HostPool + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] @@ -63,28 +68,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,8 +99,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -113,10 +118,10 @@ async def create_or_update( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. - :type host_pool: ~desktop_virtualization_api_client.models.HostPool + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.HostPool + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] @@ -124,33 +129,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(host_pool, 'HostPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(host_pool, 'HostPool') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -167,9 +168,12 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore - async def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, @@ -182,7 +186,7 @@ async def delete( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str - :param force: Force flag to delete sessionHost. + :param force: Force flag to delete sessionHost. Default value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -194,30 +198,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -227,8 +227,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -242,11 +244,11 @@ async def update( :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str - :param host_pool: Object containing HostPool definitions. - :type host_pool: ~desktop_virtualization_api_client.models.HostPoolPatch + :param host_pool: Object containing HostPool definitions. Default value is None. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.HostPool + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] @@ -254,36 +256,32 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if host_pool is not None: - body_content = self._serialize.body(host_pool, 'HostPoolPatch') + _json = self._serialize.body(host_pool, 'HostPoolPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -296,8 +294,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -309,43 +310,44 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPoolList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.HostPoolList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('HostPoolList', pipeline_response) + deserialized = self._deserialize("HostPoolList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -354,7 +356,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -363,11 +369,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools"} # type: ignore + @distributed_trace def list( self, **kwargs: Any @@ -376,42 +384,42 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPoolList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.HostPoolList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('HostPoolList', pipeline_response) + deserialized = self._deserialize("HostPoolList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -420,7 +428,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -429,11 +441,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools"} # type: ignore + @distributed_trace_async async def retrieve_registration_token( self, resource_group_name: str, @@ -448,7 +462,7 @@ async def retrieve_registration_token( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistrationInfo, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.RegistrationInfo + :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistrationInfo"] @@ -456,28 +470,25 @@ async def retrieve_registration_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.retrieve_registration_token.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_retrieve_registration_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.retrieve_registration_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -490,4 +501,6 @@ async def retrieve_registration_token( return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_registration_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken'} # type: ignore + + retrieve_registration_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken"} # type: ignore + diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py index ca996fc5e294..6e030b3457bc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._msix_images_operations import build_expand_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +29,7 @@ class MsixImagesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def expand( self, resource_group_name: str, @@ -55,55 +59,56 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. - :type msix_image_uri: ~desktop_virtualization_api_client.models.MSIXImageURI + :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ExpandMsixImageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpandMsixImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = "application/json" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.expand.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = self._serialize.body(msix_image_uri, 'MSIXImageURI') + + request = build_expand_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.expand.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + _json = self._serialize.body(msix_image_uri, 'MSIXImageURI') + + request = build_expand_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=next_link, + ) + 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('ExpandMsixImageList', pipeline_response) + deserialized = self._deserialize("ExpandMsixImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,7 +117,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -121,7 +130,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage'} # type: ignore + expand.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py index cc3e816f638c..acf021ee8c68 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._msix_packages_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class MSIXPackagesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -59,7 +64,7 @@ async def get( :type msix_package_full_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] @@ -67,29 +72,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,8 +104,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -122,10 +127,10 @@ async def create_or_update( within specified hostpool. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. - :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackage + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] @@ -133,34 +138,30 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(msix_package, 'MSIXPackage') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(msix_package, 'MSIXPackage') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -177,9 +178,12 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore - async def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, @@ -205,29 +209,26 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -237,8 +238,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -256,11 +259,11 @@ async def update( :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. :type msix_package_full_name: str - :param msix_package: Object containing MSIX Package definitions. - :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackagePatch + :param msix_package: Object containing MSIX Package definitions. Default value is None. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] @@ -268,37 +271,33 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if msix_package is not None: - body_content = self._serialize.body(msix_package, 'MSIXPackagePatch') + _json = self._serialize.body(msix_package, 'MSIXPackagePatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -311,8 +310,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + + @distributed_trace def list( self, resource_group_name: str, @@ -327,44 +329,46 @@ def list( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MSIXPackageList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.MSIXPackageList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.MSIXPackageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('MSIXPackageList', pipeline_response) + deserialized = self._deserialize("MSIXPackageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -373,7 +377,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -382,7 +390,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py index 09238b5f3413..bfb4a516cfeb 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +29,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -48,39 +52,42 @@ def list( """List all of the available operations the Desktop Virtualization resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + 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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,7 +96,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,7 +109,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.DesktopVirtualization/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.DesktopVirtualization/operations"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py index b88375bb62b7..3295086bd309 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_endpoint_connections_operations import build_delete_by_host_pool_request, build_delete_by_workspace_request, build_get_by_host_pool_request, build_get_by_workspace_request, build_list_by_host_pool_request, build_list_by_workspace_request, build_update_by_host_pool_request, build_update_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class PrivateEndpointConnectionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_host_pool( self, resource_group_name: str, @@ -54,45 +59,48 @@ def list_by_host_pool( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionListResultWithSystemData] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections"} # type: ignore + @distributed_trace_async async def get_by_host_pool( self, resource_group_name: str, @@ -133,7 +147,7 @@ async def get_by_host_pool( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -141,29 +155,26 @@ async def get_by_host_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -176,9 +187,12 @@ async def get_by_host_pool( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - async def delete_by_host_pool( + get_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def delete_by_host_pool( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, @@ -204,29 +218,26 @@ async def delete_by_host_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.delete_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -236,8 +247,10 @@ async def delete_by_host_pool( if cls: return cls(pipeline_response, None, {}) - delete_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace_async async def update_by_host_pool( self, resource_group_name: str, @@ -256,10 +269,10 @@ async def update_by_host_pool( with the Azure resource. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. - :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -267,34 +280,30 @@ async def update_by_host_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connection, 'PrivateEndpointConnection') + + request = build_update_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -307,8 +316,11 @@ async def update_by_host_pool( return cls(pipeline_response, deserialized, {}) return deserialized - update_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + update_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -322,45 +334,48 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData + or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionListResultWithSystemData] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -369,7 +384,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -378,11 +397,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore + list_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections"} # type: ignore + @distributed_trace_async async def get_by_workspace( self, resource_group_name: str, @@ -401,7 +422,7 @@ async def get_by_workspace( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -409,29 +430,26 @@ async def get_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -444,9 +462,12 @@ async def get_by_workspace( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - async def delete_by_workspace( + get_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace_async + async def delete_by_workspace( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -472,29 +493,26 @@ async def delete_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.delete_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -504,8 +522,10 @@ async def delete_by_workspace( if cls: return cls(pipeline_response, None, {}) - delete_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace_async async def update_by_workspace( self, resource_group_name: str, @@ -524,10 +544,10 @@ async def update_by_workspace( with the Azure resource. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. - :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -535,34 +555,30 @@ async def update_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connection, 'PrivateEndpointConnection') + + request = build_update_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -575,4 +591,6 @@ async def update_by_workspace( return cls(pipeline_response, deserialized, {}) return deserialized - update_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + update_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py index da58a5f3d051..dead87362da9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._private_link_resources_operations import build_list_by_host_pool_request, build_list_by_workspace_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +29,7 @@ class PrivateLinkResourcesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_host_pool( self, resource_group_name: str, @@ -54,45 +58,48 @@ def list_by_host_pool( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +108,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,11 +121,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources"} # type: ignore + @distributed_trace def list_by_workspace( self, resource_group_name: str, @@ -128,45 +141,48 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -175,7 +191,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -184,7 +204,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources'} # type: ignore + list_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py index 2efe4941d547..dcc26debd741 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._scaling_plans_operations import build_create_request, build_delete_request, build_get_request, build_list_by_host_pool_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class ScalingPlansOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -55,7 +60,7 @@ async def get( :type scaling_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] @@ -63,28 +68,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,8 +99,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -113,10 +118,10 @@ async def create( :param scaling_plan_name: The name of the scaling plan. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. - :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlan + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] @@ -124,33 +129,29 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scaling_plan, 'ScalingPlan') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scaling_plan, 'ScalingPlan') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -167,9 +168,12 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore - async def delete( + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, scaling_plan_name: str, @@ -191,28 +195,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -222,8 +223,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -237,11 +240,11 @@ async def update( :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. :type scaling_plan_name: str - :param scaling_plan: Object containing scaling plan definitions. - :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlanPatch + :param scaling_plan: Object containing scaling plan definitions. Default value is None. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] @@ -249,36 +252,32 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if scaling_plan is not None: - body_content = self._serialize.body(scaling_plan, 'ScalingPlanPatch') + _json = self._serialize.body(scaling_plan, 'ScalingPlanPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,8 +290,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -304,43 +306,44 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('ScalingPlanList', pipeline_response) + deserialized = self._deserialize("ScalingPlanList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -349,7 +352,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -358,11 +365,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans"} # type: ignore + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -371,42 +380,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('ScalingPlanList', pipeline_response) + deserialized = self._deserialize("ScalingPlanList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -415,7 +424,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -424,11 +437,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans"} # type: ignore + @distributed_trace def list_by_host_pool( self, resource_group_name: str, @@ -443,44 +458,46 @@ def list_by_host_pool( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('ScalingPlanList', pipeline_response) + deserialized = self._deserialize("ScalingPlanList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -489,7 +506,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -498,7 +519,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py index ad2bccd104f7..30831a17f73c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._session_hosts_operations import build_delete_request, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class SessionHostsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -58,7 +63,7 @@ async def get( :type session_host_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.SessionHost + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] @@ -66,29 +71,26 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,9 +103,12 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore - async def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, @@ -119,7 +124,8 @@ async def delete( :type host_pool_name: str :param session_host_name: The name of the session host within the specified host pool. :type session_host_name: str - :param force: Force flag to force sessionHost deletion even when userSession exists. + :param force: Force flag to force sessionHost deletion even when userSession exists. Default + value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -131,31 +137,27 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -165,8 +167,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}"} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -184,13 +188,14 @@ async def update( :type host_pool_name: str :param session_host_name: The name of the session host within the specified host pool. :type session_host_name: str - :param force: Force flag to update assign, unassign or reassign personal desktop. + :param force: Force flag to update assign, unassign or reassign personal desktop. Default value + is None. :type force: bool - :param session_host: Object containing SessionHost definitions. - :type session_host: ~desktop_virtualization_api_client.models.SessionHostPatch + :param session_host: Object containing SessionHost definitions. Default value is None. + :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.SessionHost + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] @@ -198,39 +203,34 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if session_host is not None: - body_content = self._serialize.body(session_host, 'SessionHostPatch') + _json = self._serialize.body(session_host, 'SessionHostPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + content_type=content_type, + json=_json, + force=force, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -243,8 +243,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}"} # type: ignore + + + @distributed_trace def list( self, resource_group_name: str, @@ -259,44 +262,46 @@ def list( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SessionHostList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.SessionHostList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHostList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('SessionHostList', pipeline_response) + deserialized = self._deserialize("SessionHostList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -305,7 +310,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -314,7 +323,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py index 2307bae8b8c2..e919b56039c8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._start_menu_items_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +29,7 @@ class StartMenuItemsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -55,44 +59,46 @@ def list( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StartMenuItemList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.StartMenuItemList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.StartMenuItemList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StartMenuItemList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('StartMenuItemList', pipeline_response) + deserialized = self._deserialize("StartMenuItemList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -101,7 +107,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -110,7 +120,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py index c8ede54eb807..55f3947502c0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._user_sessions_operations import build_delete_request, build_disconnect_request, build_get_request, build_list_by_host_pool_request, build_list_request, build_send_message_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class UserSessionsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_host_pool( self, resource_group_name: str, @@ -55,50 +60,52 @@ def list_by_host_pool( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :param filter: OData filter expression. Valid properties for filtering are userprincipalname - and sessionstate. + and sessionstate. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSessionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.UserSessionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + filter=filter, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + 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('UserSessionList', pipeline_response) + deserialized = self._deserialize("UserSessionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -116,11 +127,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions"} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -141,7 +154,7 @@ async def get( :type user_session_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSession, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.UserSession + :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSession"] @@ -149,30 +162,27 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -185,9 +195,12 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore - async def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, @@ -206,7 +219,7 @@ async def delete( :type session_host_name: str :param user_session_id: The name of the user session within the specified session host. :type user_session_id: str - :param force: Force flag to login off userSession. + :param force: Force flag to login off userSession. Default value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -218,32 +231,28 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -253,8 +262,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}"} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -272,45 +283,48 @@ def list( :type session_host_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSessionList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.UserSessionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + template_url=next_link, + ) + 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('UserSessionList', pipeline_response) + deserialized = self._deserialize("UserSessionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -319,7 +333,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -328,12 +346,14 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions"} # type: ignore - async def disconnect( + @distributed_trace_async + async def disconnect( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, @@ -361,30 +381,27 @@ async def disconnect( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.disconnect.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_disconnect_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + template_url=self.disconnect.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -394,9 +411,11 @@ async def disconnect( if cls: return cls(pipeline_response, None, {}) - disconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect'} # type: ignore + disconnect.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect"} # type: ignore + - async def send_message( + @distributed_trace_async + async def send_message( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, host_pool_name: str, @@ -415,8 +434,9 @@ async def send_message( :type session_host_name: str :param user_session_id: The name of the user session within the specified session host. :type user_session_id: str - :param send_message: Object containing message includes title and message body. - :type send_message: ~desktop_virtualization_api_client.models.SendMessage + :param send_message: Object containing message includes title and message body. Default value + is None. + :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -427,38 +447,34 @@ async def send_message( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.send_message.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if send_message is not None: - body_content = self._serialize.body(send_message, 'SendMessage') + _json = self._serialize.body(send_message, 'SendMessage') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_send_message_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.send_message.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -468,4 +484,5 @@ async def send_message( if cls: return cls(pipeline_response, None, {}) - send_message.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage'} # type: ignore + send_message.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage"} # type: ignore + diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py index 5898aa71c78f..fc04baff6eb8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # 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, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +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.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._workspaces_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class WorkspacesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -55,7 +60,7 @@ async def get( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Workspace + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] @@ -63,28 +68,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,8 +99,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -113,10 +118,10 @@ async def create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param workspace: Object containing Workspace definitions. - :type workspace: ~desktop_virtualization_api_client.models.Workspace + :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Workspace + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] @@ -124,33 +129,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace, 'Workspace') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -167,9 +168,12 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore - async def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, workspace_name: str, @@ -191,28 +195,25 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -222,8 +223,10 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, @@ -237,11 +240,11 @@ async def update( :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param workspace: Object containing Workspace definitions. - :type workspace: ~desktop_virtualization_api_client.models.WorkspacePatch + :param workspace: Object containing Workspace definitions. Default value is None. + :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Workspace + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] @@ -249,36 +252,32 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if workspace is not None: - body_content = self._serialize.body(workspace, 'WorkspacePatch') + _json = self._serialize.body(workspace, 'WorkspacePatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -291,8 +290,11 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, resource_group_name: str, @@ -304,43 +306,44 @@ def list_by_resource_group( :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.WorkspaceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -349,7 +352,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -358,11 +365,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces"} # type: ignore + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -371,42 +380,42 @@ def list_by_subscription( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.WorkspaceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -415,7 +424,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -424,7 +437,8 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py index cf41bbdc9aa6..c1bd744a5859 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py @@ -6,147 +6,87 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Application - from ._models_py3 import ApplicationGroup - from ._models_py3 import ApplicationGroupList - from ._models_py3 import ApplicationGroupPatch - from ._models_py3 import ApplicationList - from ._models_py3 import ApplicationPatch - from ._models_py3 import CloudErrorProperties - from ._models_py3 import Desktop - from ._models_py3 import DesktopList - from ._models_py3 import DesktopPatch - from ._models_py3 import ExpandMsixImage - from ._models_py3 import ExpandMsixImageList - from ._models_py3 import HostPool - from ._models_py3 import HostPoolList - from ._models_py3 import HostPoolPatch - from ._models_py3 import Identity - from ._models_py3 import LogSpecification - from ._models_py3 import MSIXImageURI - from ._models_py3 import MSIXPackage - from ._models_py3 import MSIXPackageList - from ._models_py3 import MSIXPackagePatch - from ._models_py3 import MigrationRequestProperties - from ._models_py3 import MsixPackageApplications - from ._models_py3 import MsixPackageDependencies - from ._models_py3 import OperationProperties - from ._models_py3 import Plan - from ._models_py3 import PrivateEndpoint - from ._models_py3 import PrivateEndpointConnection - from ._models_py3 import PrivateEndpointConnectionListResultWithSystemData - from ._models_py3 import PrivateEndpointConnectionWithSystemData - from ._models_py3 import PrivateLinkResource - from ._models_py3 import PrivateLinkResourceListResult - from ._models_py3 import PrivateLinkServiceConnectionState - from ._models_py3 import RegistrationInfo - from ._models_py3 import RegistrationInfoPatch - from ._models_py3 import Resource - from ._models_py3 import ResourceModelWithAllowedPropertySet - from ._models_py3 import ResourceModelWithAllowedPropertySetIdentity - from ._models_py3 import ResourceModelWithAllowedPropertySetPlan - from ._models_py3 import ResourceModelWithAllowedPropertySetSku - from ._models_py3 import ResourceProviderOperation - from ._models_py3 import ResourceProviderOperationDisplay - from ._models_py3 import ResourceProviderOperationList - from ._models_py3 import ScalingHostPoolReference - from ._models_py3 import ScalingPlan - from ._models_py3 import ScalingPlanList - from ._models_py3 import ScalingPlanPatch - from ._models_py3 import ScalingSchedule - from ._models_py3 import SendMessage - from ._models_py3 import ServiceSpecification - from ._models_py3 import SessionHost - from ._models_py3 import SessionHostHealthCheckFailureDetails - from ._models_py3 import SessionHostHealthCheckReport - from ._models_py3 import SessionHostList - from ._models_py3 import SessionHostPatch - from ._models_py3 import Sku - from ._models_py3 import StartMenuItem - from ._models_py3 import StartMenuItemList - from ._models_py3 import SystemData - from ._models_py3 import Time - from ._models_py3 import UserSession - from ._models_py3 import UserSessionList - from ._models_py3 import Workspace - from ._models_py3 import WorkspaceList - from ._models_py3 import WorkspacePatch -except (SyntaxError, ImportError): - from ._models import Application # type: ignore - from ._models import ApplicationGroup # type: ignore - from ._models import ApplicationGroupList # type: ignore - from ._models import ApplicationGroupPatch # type: ignore - from ._models import ApplicationList # type: ignore - from ._models import ApplicationPatch # type: ignore - from ._models import CloudErrorProperties # type: ignore - from ._models import Desktop # type: ignore - from ._models import DesktopList # type: ignore - from ._models import DesktopPatch # type: ignore - from ._models import ExpandMsixImage # type: ignore - from ._models import ExpandMsixImageList # type: ignore - from ._models import HostPool # type: ignore - from ._models import HostPoolList # type: ignore - from ._models import HostPoolPatch # type: ignore - from ._models import Identity # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import MSIXImageURI # type: ignore - from ._models import MSIXPackage # type: ignore - from ._models import MSIXPackageList # type: ignore - from ._models import MSIXPackagePatch # type: ignore - from ._models import MigrationRequestProperties # type: ignore - from ._models import MsixPackageApplications # type: ignore - from ._models import MsixPackageDependencies # type: ignore - from ._models import OperationProperties # type: ignore - from ._models import Plan # type: ignore - from ._models import PrivateEndpoint # type: ignore - from ._models import PrivateEndpointConnection # type: ignore - from ._models import PrivateEndpointConnectionListResultWithSystemData # type: ignore - from ._models import PrivateEndpointConnectionWithSystemData # type: ignore - from ._models import PrivateLinkResource # type: ignore - from ._models import PrivateLinkResourceListResult # type: ignore - from ._models import PrivateLinkServiceConnectionState # type: ignore - from ._models import RegistrationInfo # type: ignore - from ._models import RegistrationInfoPatch # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceModelWithAllowedPropertySet # type: ignore - from ._models import ResourceModelWithAllowedPropertySetIdentity # type: ignore - from ._models import ResourceModelWithAllowedPropertySetPlan # type: ignore - from ._models import ResourceModelWithAllowedPropertySetSku # type: ignore - from ._models import ResourceProviderOperation # type: ignore - from ._models import ResourceProviderOperationDisplay # type: ignore - from ._models import ResourceProviderOperationList # type: ignore - from ._models import ScalingHostPoolReference # type: ignore - from ._models import ScalingPlan # type: ignore - from ._models import ScalingPlanList # type: ignore - from ._models import ScalingPlanPatch # type: ignore - from ._models import ScalingSchedule # type: ignore - from ._models import SendMessage # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import SessionHost # type: ignore - from ._models import SessionHostHealthCheckFailureDetails # type: ignore - from ._models import SessionHostHealthCheckReport # type: ignore - from ._models import SessionHostList # type: ignore - from ._models import SessionHostPatch # type: ignore - from ._models import Sku # type: ignore - from ._models import StartMenuItem # type: ignore - from ._models import StartMenuItemList # type: ignore - from ._models import SystemData # type: ignore - from ._models import Time # type: ignore - from ._models import UserSession # type: ignore - from ._models import UserSessionList # type: ignore - from ._models import Workspace # type: ignore - from ._models import WorkspaceList # type: ignore - from ._models import WorkspacePatch # type: ignore +from ._models_py3 import AgentUpdatePatchProperties +from ._models_py3 import AgentUpdateProperties +from ._models_py3 import Application +from ._models_py3 import ApplicationGroup +from ._models_py3 import ApplicationGroupList +from ._models_py3 import ApplicationGroupPatch +from ._models_py3 import ApplicationList +from ._models_py3 import ApplicationPatch +from ._models_py3 import CloudErrorProperties +from ._models_py3 import Desktop +from ._models_py3 import DesktopList +from ._models_py3 import DesktopPatch +from ._models_py3 import ExpandMsixImage +from ._models_py3 import ExpandMsixImageList +from ._models_py3 import HostPool +from ._models_py3 import HostPoolList +from ._models_py3 import HostPoolPatch +from ._models_py3 import Identity +from ._models_py3 import LogSpecification +from ._models_py3 import MSIXImageURI +from ._models_py3 import MSIXPackage +from ._models_py3 import MSIXPackageList +from ._models_py3 import MSIXPackagePatch +from ._models_py3 import MaintenanceWindowPatchProperties +from ._models_py3 import MaintenanceWindowProperties +from ._models_py3 import MigrationRequestProperties +from ._models_py3 import MsixPackageApplications +from ._models_py3 import MsixPackageDependencies +from ._models_py3 import OperationProperties +from ._models_py3 import Plan +from ._models_py3 import PrivateEndpoint +from ._models_py3 import PrivateEndpointConnection +from ._models_py3 import PrivateEndpointConnectionListResultWithSystemData +from ._models_py3 import PrivateEndpointConnectionWithSystemData +from ._models_py3 import PrivateLinkResource +from ._models_py3 import PrivateLinkResourceListResult +from ._models_py3 import PrivateLinkServiceConnectionState +from ._models_py3 import RegistrationInfo +from ._models_py3 import RegistrationInfoPatch +from ._models_py3 import Resource +from ._models_py3 import ResourceModelWithAllowedPropertySet +from ._models_py3 import ResourceModelWithAllowedPropertySetIdentity +from ._models_py3 import ResourceModelWithAllowedPropertySetPlan +from ._models_py3 import ResourceModelWithAllowedPropertySetSku +from ._models_py3 import ResourceProviderOperation +from ._models_py3 import ResourceProviderOperationDisplay +from ._models_py3 import ResourceProviderOperationList +from ._models_py3 import ScalingHostPoolReference +from ._models_py3 import ScalingPlan +from ._models_py3 import ScalingPlanList +from ._models_py3 import ScalingPlanPatch +from ._models_py3 import ScalingSchedule +from ._models_py3 import SendMessage +from ._models_py3 import ServiceSpecification +from ._models_py3 import SessionHost +from ._models_py3 import SessionHostHealthCheckFailureDetails +from ._models_py3 import SessionHostHealthCheckReport +from ._models_py3 import SessionHostList +from ._models_py3 import SessionHostPatch +from ._models_py3 import Sku +from ._models_py3 import StartMenuItem +from ._models_py3 import StartMenuItemList +from ._models_py3 import SystemData +from ._models_py3 import Time +from ._models_py3 import UserSession +from ._models_py3 import UserSessionList +from ._models_py3 import Workspace +from ._models_py3 import WorkspaceList +from ._models_py3 import WorkspacePatch + from ._desktop_virtualization_api_client_enums import ( ApplicationGroupType, ApplicationType, CommandLineSetting, CreatedByType, + DayOfWeek, HealthCheckName, HealthCheckResult, HostPoolType, + HostpoolPublicNetworkAccess, LoadBalancerType, Operation, PersonalDesktopAssignmentType, @@ -159,6 +99,7 @@ SSOSecretType, ScalingHostPoolType, ScalingScheduleDaysOfWeekItem, + SessionHostComponentUpdateType, SessionHostLoadBalancingAlgorithm, SessionState, SkuTier, @@ -168,6 +109,8 @@ ) __all__ = [ + 'AgentUpdatePatchProperties', + 'AgentUpdateProperties', 'Application', 'ApplicationGroup', 'ApplicationGroupList', @@ -189,6 +132,8 @@ 'MSIXPackage', 'MSIXPackageList', 'MSIXPackagePatch', + 'MaintenanceWindowPatchProperties', + 'MaintenanceWindowProperties', 'MigrationRequestProperties', 'MsixPackageApplications', 'MsixPackageDependencies', @@ -237,9 +182,11 @@ 'ApplicationType', 'CommandLineSetting', 'CreatedByType', + 'DayOfWeek', 'HealthCheckName', 'HealthCheckResult', 'HostPoolType', + 'HostpoolPublicNetworkAccess', 'LoadBalancerType', 'Operation', 'PersonalDesktopAssignmentType', @@ -252,6 +199,7 @@ 'SSOSecretType', 'ScalingHostPoolType', 'ScalingScheduleDaysOfWeekItem', + 'SessionHostComponentUpdateType', 'SessionHostLoadBalancingAlgorithm', 'SessionState', 'SkuTier', diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py index 493339676783..9357bb8fcf33 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py @@ -6,41 +6,26 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ApplicationGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApplicationGroupType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource Type of ApplicationGroup. """ REMOTE_APP = "RemoteApp" DESKTOP = "Desktop" -class ApplicationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApplicationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Application type of application. """ REMOTE_APP = "RemoteApp" DESKTOP = "Desktop" -class CommandLineSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CommandLineSetting(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. @@ -50,7 +35,7 @@ class CommandLineSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ALLOW = "Allow" REQUIRE = "Require" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -59,7 +44,19 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class HealthCheckName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DayOfWeek(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Day of the week. + """ + + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + SUNDAY = "Sunday" + +class HealthCheckName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Represents the name of the health check operation performed. """ @@ -115,7 +112,7 @@ class HealthCheckName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: end-users. APP_ATTACH_HEALTH_CHECK = "AppAttachHealthCheck" -class HealthCheckResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HealthCheckResult(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Represents the Health state of the health check we performed. """ @@ -128,7 +125,17 @@ class HealthCheckResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: We received a Shutdown notification. SESSION_HOST_SHUTDOWN = "SessionHostShutdown" -class HostPoolType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class HostpoolPublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enabled allows this resource to be accessed from both public and private networks, Disabled + allows this resource to only be accessed via private endpoints + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + ENABLED_FOR_SESSION_HOSTS_ONLY = "EnabledForSessionHostsOnly" + ENABLED_FOR_CLIENTS_ONLY = "EnabledForClientsOnly" + +class HostPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """HostPool type for desktop. """ @@ -142,7 +149,7 @@ class HostPoolType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: PersonalDesktopAssignmentType must be Direct. BYO_DESKTOP = "BYODesktop" -class LoadBalancerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class LoadBalancerType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of the load balancer. """ @@ -150,7 +157,7 @@ class LoadBalancerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): DEPTH_FIRST = "DepthFirst" PERSISTENT = "Persistent" -class Operation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Operation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of operation for migration. """ @@ -165,14 +172,14 @@ class Operation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Unhide the hostpool. UNHIDE = "Unhide" -class PersonalDesktopAssignmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PersonalDesktopAssignmentType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """PersonalDesktopAssignment type for HostPool. """ AUTOMATIC = "Automatic" DIRECT = "Direct" -class PreferredAppGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PreferredAppGroupType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of preferred application group type, default to Desktop Application Group """ @@ -180,7 +187,7 @@ class PreferredAppGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) DESKTOP = "Desktop" RAIL_APPLICATIONS = "RailApplications" -class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointConnectionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current provisioning state. """ @@ -189,7 +196,7 @@ class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitive DELETING = "Deleting" FAILED = "Failed" -class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointServiceConnectionStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The private endpoint connection status. """ @@ -197,7 +204,7 @@ class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnum APPROVED = "Approved" REJECTED = "Rejected" -class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PublicNetworkAccess(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints """ @@ -205,7 +212,7 @@ class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): ENABLED = "Enabled" DISABLED = "Disabled" -class RegistrationTokenOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RegistrationTokenOperation(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of resetting the token. """ @@ -213,21 +220,21 @@ class RegistrationTokenOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, E NONE = "None" UPDATE = "Update" -class RemoteApplicationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RemoteApplicationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource Type of Application. """ IN_BUILT = "InBuilt" MSIX_APPLICATION = "MsixApplication" -class ScalingHostPoolType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScalingHostPoolType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """HostPool type for desktop. """ #: Users get a new (random) SessionHost every time it connects to the HostPool. POOLED = "Pooled" -class ScalingScheduleDaysOfWeekItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ScalingScheduleDaysOfWeekItem(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): SUNDAY = "Sunday" MONDAY = "Monday" @@ -237,14 +244,23 @@ class ScalingScheduleDaysOfWeekItem(with_metaclass(_CaseInsensitiveEnumMeta, str FRIDAY = "Friday" SATURDAY = "Saturday" -class SessionHostLoadBalancingAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SessionHostComponentUpdateType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of maintenance for session host components. + """ + + #: Agent and other agent side components are delivery schedule is controlled by WVD Infra. + DEFAULT = "Default" + #: TenantAdmin have opted in for Scheduled Component Update feature. + SCHEDULED = "Scheduled" + +class SessionHostLoadBalancingAlgorithm(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Load balancing algorithm for ramp up period. """ BREADTH_FIRST = "BreadthFirst" DEPTH_FIRST = "DepthFirst" -class SessionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SessionState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """State of user session. """ @@ -255,7 +271,7 @@ class SessionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): LOG_OFF = "LogOff" USER_PROFILE_DISK_MOUNTED = "UserProfileDiskMounted" -class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. """ @@ -265,7 +281,7 @@ class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): STANDARD = "Standard" PREMIUM = "Premium" -class SSOSecretType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SSOSecretType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of single sign on Secret Type. """ @@ -274,7 +290,7 @@ class SSOSecretType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SHARED_KEY_IN_KEY_VAULT = "SharedKeyInKeyVault" CERTIFICATE_IN_KEY_VAULT = "CertificateInKeyVault" -class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Status(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status for a SessionHost. """ @@ -309,14 +325,14 @@ class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: connections might not fail, as these issues are not fatal. NEEDS_ASSISTANCE = "NeedsAssistance" -class StopHostsWhen(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StopHostsWhen(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies when to stop hosts during ramp down period. """ ZERO_SESSIONS = "ZeroSessions" ZERO_ACTIVE_SESSIONS = "ZeroActiveSessions" -class UpdateState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpdateState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Update state of a SessionHost. """ diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models.py deleted file mode 100644 index ddf752c9348e..000000000000 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models.py +++ /dev/null @@ -1,3114 +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. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class Resource(msrest.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. 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 - """ - - _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'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Application(Resource): - """Schema for Application properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of Application. (internal use). - :vartype object_id: str - :param description: Description of Application. - :type description: str - :param friendly_name: Friendly name of Application. - :type friendly_name: str - :param file_path: Specifies a path for the executable file for the application. - :type file_path: str - :param msix_package_family_name: Specifies the package family name for MSIX applications. - :type msix_package_family_name: str - :param msix_package_application_id: Specifies the package application Id for MSIX applications. - :type msix_package_application_id: str - :param application_type: Resource Type of Application. Possible values include: "InBuilt", - "MsixApplication". - :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType - :param command_line_setting: Required. Specifies whether this published application can be - launched with command line arguments provided by the client, command line arguments specified - at publish time, or no command line arguments at all. Possible values include: "DoNotAllow", - "Allow", "Require". - :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting - :param command_line_arguments: Command Line Arguments for Application. - :type command_line_arguments: str - :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access - server. - :type show_in_portal: bool - :param icon_path: Path to icon. - :type icon_path: str - :param icon_index: Index of the icon. - :type icon_index: int - :ivar icon_hash: Hash of the icon. - :vartype icon_hash: str - :ivar icon_content: the icon a 64 bit string as a byte array. - :vartype icon_content: bytearray - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'readonly': True}, - 'command_line_setting': {'required': True}, - 'icon_hash': {'readonly': True}, - 'icon_content': {'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'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'file_path': {'key': 'properties.filePath', 'type': 'str'}, - 'msix_package_family_name': {'key': 'properties.msixPackageFamilyName', 'type': 'str'}, - 'msix_package_application_id': {'key': 'properties.msixPackageApplicationId', 'type': 'str'}, - 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, - 'command_line_setting': {'key': 'properties.commandLineSetting', 'type': 'str'}, - 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, - 'show_in_portal': {'key': 'properties.showInPortal', 'type': 'bool'}, - 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, - 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, - 'icon_hash': {'key': 'properties.iconHash', 'type': 'str'}, - 'icon_content': {'key': 'properties.iconContent', 'type': 'bytearray'}, - } - - def __init__( - self, - **kwargs - ): - super(Application, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.file_path = kwargs.get('file_path', None) - self.msix_package_family_name = kwargs.get('msix_package_family_name', None) - self.msix_package_application_id = kwargs.get('msix_package_application_id', None) - self.application_type = kwargs.get('application_type', None) - self.command_line_setting = kwargs['command_line_setting'] - self.command_line_arguments = kwargs.get('command_line_arguments', None) - self.show_in_portal = kwargs.get('show_in_portal', None) - self.icon_path = kwargs.get('icon_path', None) - self.icon_index = kwargs.get('icon_index', None) - self.icon_hash = None - self.icon_content = None - - -class ResourceModelWithAllowedPropertySet(msrest.serialization.Model): - """The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. - Indicates if this resource is managed by another Azure resource. If this is present, complete - mode deployment will not delete the resource if it is removed from the template since it is - managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :type kind: str - :ivar etag: The etag field is *not* required. If it is provided in the response body, it must - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - (section 14.27) header fields. - :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, - 'etag': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, - 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, - 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceModelWithAllowedPropertySet, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.managed_by = kwargs.get('managed_by', None) - self.kind = kwargs.get('kind', None) - self.etag = None - self.tags = kwargs.get('tags', None) - self.identity = kwargs.get('identity', None) - self.sku = kwargs.get('sku', None) - self.plan = kwargs.get('plan', None) - - -class ApplicationGroup(ResourceModelWithAllowedPropertySet): - """Represents a ApplicationGroup definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. - Indicates if this resource is managed by another Azure resource. If this is present, complete - mode deployment will not delete the resource if it is removed from the template since it is - managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :type kind: str - :ivar etag: The etag field is *not* required. If it is provided in the response body, it must - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - (section 14.27) header fields. - :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of ApplicationGroup. (internal use). - :vartype object_id: str - :param description: Description of ApplicationGroup. - :type description: str - :param friendly_name: Friendly name of ApplicationGroup. - :type friendly_name: str - :param host_pool_arm_path: Required. HostPool arm path of ApplicationGroup. - :type host_pool_arm_path: str - :ivar workspace_arm_path: Workspace arm path of ApplicationGroup. - :vartype workspace_arm_path: str - :param application_group_type: Required. Resource Type of ApplicationGroup. Possible values - include: "RemoteApp", "Desktop". - :type application_group_type: str or - ~desktop_virtualization_api_client.models.ApplicationGroupType - :param migration_request: The registration info of HostPool. - :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties - :ivar cloud_pc_resource: Is cloud pc resource. - :vartype cloud_pc_resource: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'readonly': True}, - 'host_pool_arm_path': {'required': True}, - 'workspace_arm_path': {'readonly': True}, - 'application_group_type': {'required': True}, - 'cloud_pc_resource': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, - 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, - 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'host_pool_arm_path': {'key': 'properties.hostPoolArmPath', 'type': 'str'}, - 'workspace_arm_path': {'key': 'properties.workspaceArmPath', 'type': 'str'}, - 'application_group_type': {'key': 'properties.applicationGroupType', 'type': 'str'}, - 'migration_request': {'key': 'properties.migrationRequest', 'type': 'MigrationRequestProperties'}, - 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationGroup, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.host_pool_arm_path = kwargs['host_pool_arm_path'] - self.workspace_arm_path = None - self.application_group_type = kwargs['application_group_type'] - self.migration_request = kwargs.get('migration_request', None) - self.cloud_pc_resource = None - - -class ApplicationGroupList(msrest.serialization.Model): - """List of ApplicationGroup definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of ApplicationGroup definitions. - :type value: list[~desktop_virtualization_api_client.models.ApplicationGroup] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationGroup]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationGroupList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationGroupPatch(Resource): - """ApplicationGroup properties that can be patched. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of ApplicationGroup. - :type description: str - :param friendly_name: Friendly name of ApplicationGroup. - :type friendly_name: 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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationGroupPatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - - -class ApplicationList(msrest.serialization.Model): - """List of Application definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of Application definitions. - :type value: list[~desktop_virtualization_api_client.models.Application] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Application]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationPatch(msrest.serialization.Model): - """Application properties that can be patched. - - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of Application. - :type description: str - :param friendly_name: Friendly name of Application. - :type friendly_name: str - :param file_path: Specifies a path for the executable file for the application. - :type file_path: str - :param command_line_setting: Specifies whether this published application can be launched with - command line arguments provided by the client, command line arguments specified at publish - time, or no command line arguments at all. Possible values include: "DoNotAllow", "Allow", - "Require". - :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting - :param command_line_arguments: Command Line Arguments for Application. - :type command_line_arguments: str - :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access - server. - :type show_in_portal: bool - :param icon_path: Path to icon. - :type icon_path: str - :param icon_index: Index of the icon. - :type icon_index: int - :param msix_package_family_name: Specifies the package family name for MSIX applications. - :type msix_package_family_name: str - :param msix_package_application_id: Specifies the package application Id for MSIX applications. - :type msix_package_application_id: str - :param application_type: Resource Type of Application. Possible values include: "InBuilt", - "MsixApplication". - :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'file_path': {'key': 'properties.filePath', 'type': 'str'}, - 'command_line_setting': {'key': 'properties.commandLineSetting', 'type': 'str'}, - 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, - 'show_in_portal': {'key': 'properties.showInPortal', 'type': 'bool'}, - 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, - 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, - 'msix_package_family_name': {'key': 'properties.msixPackageFamilyName', 'type': 'str'}, - 'msix_package_application_id': {'key': 'properties.msixPackageApplicationId', 'type': 'str'}, - 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationPatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.file_path = kwargs.get('file_path', None) - self.command_line_setting = kwargs.get('command_line_setting', None) - self.command_line_arguments = kwargs.get('command_line_arguments', None) - self.show_in_portal = kwargs.get('show_in_portal', None) - self.icon_path = kwargs.get('icon_path', None) - self.icon_index = kwargs.get('icon_index', None) - self.msix_package_family_name = kwargs.get('msix_package_family_name', None) - self.msix_package_application_id = kwargs.get('msix_package_application_id', None) - self.application_type = kwargs.get('application_type', None) - - -class CloudErrorProperties(msrest.serialization.Model): - """Cloud error object properties. - - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorProperties, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class Desktop(Resource): - """Schema for Desktop properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of Desktop. (internal use). - :vartype object_id: str - :param description: Description of Desktop. - :type description: str - :param friendly_name: Friendly name of Desktop. - :type friendly_name: str - :ivar icon_hash: Hash of the icon. - :vartype icon_hash: str - :ivar icon_content: The icon a 64 bit string as a byte array. - :vartype icon_content: bytearray - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'readonly': True}, - 'icon_hash': {'readonly': True}, - 'icon_content': {'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'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'icon_hash': {'key': 'properties.iconHash', 'type': 'str'}, - 'icon_content': {'key': 'properties.iconContent', 'type': 'bytearray'}, - } - - def __init__( - self, - **kwargs - ): - super(Desktop, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.icon_hash = None - self.icon_content = None - - -class DesktopList(msrest.serialization.Model): - """List of Desktop definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of Desktop definitions. - :type value: list[~desktop_virtualization_api_client.models.Desktop] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Desktop]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DesktopList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class DesktopPatch(msrest.serialization.Model): - """Desktop properties that can be patched. - - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of Desktop. - :type description: str - :param friendly_name: Friendly name of Desktop. - :type friendly_name: str - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DesktopPatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - - -class ExpandMsixImage(Resource): - """Represents the definition of contents retrieved after expanding the MSIX Image. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param package_alias: Alias of MSIX Package. - :type package_alias: str - :param image_path: VHD/CIM image path on Network Share. - :type image_path: str - :param package_name: Package Name from appxmanifest.xml. - :type package_name: str - :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name - and Publisher name. - :type package_family_name: str - :param package_full_name: Package Full Name from appxmanifest.xml. - :type package_full_name: str - :param display_name: User friendly Name to be displayed in the portal. - :type display_name: str - :param package_relative_path: Relative Path to the package inside the image. - :type package_relative_path: str - :param is_regular_registration: Specifies how to register Package in feed. - :type is_regular_registration: bool - :param is_active: Make this version of the package the active one across the hostpool. - :type is_active: bool - :param package_dependencies: List of package dependencies. - :type package_dependencies: - list[~desktop_virtualization_api_client.models.MsixPackageDependencies] - :param version: Package Version found in the appxmanifest.xml. - :type version: str - :param last_updated: Date Package was last updated, found in the appxmanifest.xml. - :type last_updated: ~datetime.datetime - :param package_applications: List of package applications. - :type package_applications: - list[~desktop_virtualization_api_client.models.MsixPackageApplications] - """ - - _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'}, - 'package_alias': {'key': 'properties.packageAlias', 'type': 'str'}, - 'image_path': {'key': 'properties.imagePath', 'type': 'str'}, - 'package_name': {'key': 'properties.packageName', 'type': 'str'}, - 'package_family_name': {'key': 'properties.packageFamilyName', 'type': 'str'}, - 'package_full_name': {'key': 'properties.packageFullName', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'package_relative_path': {'key': 'properties.packageRelativePath', 'type': 'str'}, - 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, - 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, - 'package_dependencies': {'key': 'properties.packageDependencies', 'type': '[MsixPackageDependencies]'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'last_updated': {'key': 'properties.lastUpdated', 'type': 'iso-8601'}, - 'package_applications': {'key': 'properties.packageApplications', 'type': '[MsixPackageApplications]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExpandMsixImage, self).__init__(**kwargs) - self.package_alias = kwargs.get('package_alias', None) - self.image_path = kwargs.get('image_path', None) - self.package_name = kwargs.get('package_name', None) - self.package_family_name = kwargs.get('package_family_name', None) - self.package_full_name = kwargs.get('package_full_name', None) - self.display_name = kwargs.get('display_name', None) - self.package_relative_path = kwargs.get('package_relative_path', None) - self.is_regular_registration = kwargs.get('is_regular_registration', None) - self.is_active = kwargs.get('is_active', None) - self.package_dependencies = kwargs.get('package_dependencies', None) - self.version = kwargs.get('version', None) - self.last_updated = kwargs.get('last_updated', None) - self.package_applications = kwargs.get('package_applications', None) - - -class ExpandMsixImageList(msrest.serialization.Model): - """List of MSIX package properties retrieved from MSIX Image expansion. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of MSIX package properties from give MSIX Image. - :type value: list[~desktop_virtualization_api_client.models.ExpandMsixImage] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExpandMsixImage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExpandMsixImageList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class HostPool(ResourceModelWithAllowedPropertySet): - """Represents a HostPool definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. - Indicates if this resource is managed by another Azure resource. If this is present, complete - mode deployment will not delete the resource if it is removed from the template since it is - managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :type kind: str - :ivar etag: The etag field is *not* required. If it is provided in the response body, it must - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - (section 14.27) header fields. - :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of HostPool. (internal use). - :vartype object_id: str - :param friendly_name: Friendly name of HostPool. - :type friendly_name: str - :param description: Description of HostPool. - :type description: str - :param host_pool_type: Required. HostPool type for desktop. Possible values include: - "Personal", "Pooled", "BYODesktop". - :type host_pool_type: str or ~desktop_virtualization_api_client.models.HostPoolType - :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible - values include: "Automatic", "Direct". - :type personal_desktop_assignment_type: str or - ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType - :param custom_rdp_property: Custom rdp property of HostPool. - :type custom_rdp_property: str - :param max_session_limit: The max session limit of HostPool. - :type max_session_limit: int - :param load_balancer_type: Required. The type of the load balancer. Possible values include: - "BreadthFirst", "DepthFirst", "Persistent". - :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType - :param ring: The ring number of HostPool. - :type ring: int - :param validation_environment: Is validation environment. - :type validation_environment: bool - :param registration_info: The registration info of HostPool. - :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfo - :param vm_template: VM template for sessionhosts configuration within hostpool. - :type vm_template: str - :ivar application_group_references: List of applicationGroup links. - :vartype application_group_references: list[str] - :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. - :type ssoadfs_authority: str - :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO - certificates. - :type sso_client_id: str - :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for - communication to ADFS. - :type sso_client_secret_key_vault_path: str - :param sso_secret_type: The type of single sign on Secret Type. Possible values include: - "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". - :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType - :param preferred_app_group_type: Required. The type of preferred application group type, - default to Desktop Application Group. Possible values include: "None", "Desktop", - "RailApplications". - :type preferred_app_group_type: str or - ~desktop_virtualization_api_client.models.PreferredAppGroupType - :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. - :type start_vm_on_connect: bool - :param migration_request: The registration info of HostPool. - :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties - :ivar cloud_pc_resource: Is cloud pc resource. - :vartype cloud_pc_resource: bool - :param public_network_access: Enabled allows this resource to be accessed from both public and - private networks, Disabled allows this resource to only be accessed via private endpoints. - Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'readonly': True}, - 'host_pool_type': {'required': True}, - 'load_balancer_type': {'required': True}, - 'application_group_references': {'readonly': True}, - 'preferred_app_group_type': {'required': True}, - 'cloud_pc_resource': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, - 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, - 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'host_pool_type': {'key': 'properties.hostPoolType', 'type': 'str'}, - 'personal_desktop_assignment_type': {'key': 'properties.personalDesktopAssignmentType', 'type': 'str'}, - 'custom_rdp_property': {'key': 'properties.customRdpProperty', 'type': 'str'}, - 'max_session_limit': {'key': 'properties.maxSessionLimit', 'type': 'int'}, - 'load_balancer_type': {'key': 'properties.loadBalancerType', 'type': 'str'}, - 'ring': {'key': 'properties.ring', 'type': 'int'}, - 'validation_environment': {'key': 'properties.validationEnvironment', 'type': 'bool'}, - 'registration_info': {'key': 'properties.registrationInfo', 'type': 'RegistrationInfo'}, - 'vm_template': {'key': 'properties.vmTemplate', 'type': 'str'}, - 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, - 'ssoadfs_authority': {'key': 'properties.ssoadfsAuthority', 'type': 'str'}, - 'sso_client_id': {'key': 'properties.ssoClientId', 'type': 'str'}, - 'sso_client_secret_key_vault_path': {'key': 'properties.ssoClientSecretKeyVaultPath', 'type': 'str'}, - 'sso_secret_type': {'key': 'properties.ssoSecretType', 'type': 'str'}, - 'preferred_app_group_type': {'key': 'properties.preferredAppGroupType', 'type': 'str'}, - 'start_vm_on_connect': {'key': 'properties.startVMOnConnect', 'type': 'bool'}, - 'migration_request': {'key': 'properties.migrationRequest', 'type': 'MigrationRequestProperties'}, - 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HostPool, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.friendly_name = kwargs.get('friendly_name', None) - self.description = kwargs.get('description', None) - self.host_pool_type = kwargs['host_pool_type'] - self.personal_desktop_assignment_type = kwargs.get('personal_desktop_assignment_type', None) - self.custom_rdp_property = kwargs.get('custom_rdp_property', None) - self.max_session_limit = kwargs.get('max_session_limit', None) - self.load_balancer_type = kwargs['load_balancer_type'] - self.ring = kwargs.get('ring', None) - self.validation_environment = kwargs.get('validation_environment', None) - self.registration_info = kwargs.get('registration_info', None) - self.vm_template = kwargs.get('vm_template', None) - self.application_group_references = None - self.ssoadfs_authority = kwargs.get('ssoadfs_authority', None) - self.sso_client_id = kwargs.get('sso_client_id', None) - self.sso_client_secret_key_vault_path = kwargs.get('sso_client_secret_key_vault_path', None) - self.sso_secret_type = kwargs.get('sso_secret_type', None) - self.preferred_app_group_type = kwargs['preferred_app_group_type'] - self.start_vm_on_connect = kwargs.get('start_vm_on_connect', None) - self.migration_request = kwargs.get('migration_request', None) - self.cloud_pc_resource = None - self.public_network_access = kwargs.get('public_network_access', None) - - -class HostPoolList(msrest.serialization.Model): - """List of HostPool definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of HostPool definitions. - :type value: list[~desktop_virtualization_api_client.models.HostPool] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[HostPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HostPoolList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class HostPoolPatch(Resource): - """HostPool properties that can be patched. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param friendly_name: Friendly name of HostPool. - :type friendly_name: str - :param description: Description of HostPool. - :type description: str - :param custom_rdp_property: Custom rdp property of HostPool. - :type custom_rdp_property: str - :param max_session_limit: The max session limit of HostPool. - :type max_session_limit: int - :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible - values include: "Automatic", "Direct". - :type personal_desktop_assignment_type: str or - ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType - :param load_balancer_type: The type of the load balancer. Possible values include: - "BreadthFirst", "DepthFirst", "Persistent". - :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType - :param ring: The ring number of HostPool. - :type ring: int - :param validation_environment: Is validation environment. - :type validation_environment: bool - :param registration_info: The registration info of HostPool. - :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfoPatch - :param vm_template: VM template for sessionhosts configuration within hostpool. - :type vm_template: str - :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. - :type ssoadfs_authority: str - :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO - certificates. - :type sso_client_id: str - :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for - communication to ADFS. - :type sso_client_secret_key_vault_path: str - :param sso_secret_type: The type of single sign on Secret Type. Possible values include: - "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". - :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType - :param preferred_app_group_type: The type of preferred application group type, default to - Desktop Application Group. Possible values include: "None", "Desktop", "RailApplications". - :type preferred_app_group_type: str or - ~desktop_virtualization_api_client.models.PreferredAppGroupType - :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. - :type start_vm_on_connect: bool - :param public_network_access: Enabled to allow this resource to be access from the public - network. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess - """ - - _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'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'custom_rdp_property': {'key': 'properties.customRdpProperty', 'type': 'str'}, - 'max_session_limit': {'key': 'properties.maxSessionLimit', 'type': 'int'}, - 'personal_desktop_assignment_type': {'key': 'properties.personalDesktopAssignmentType', 'type': 'str'}, - 'load_balancer_type': {'key': 'properties.loadBalancerType', 'type': 'str'}, - 'ring': {'key': 'properties.ring', 'type': 'int'}, - 'validation_environment': {'key': 'properties.validationEnvironment', 'type': 'bool'}, - 'registration_info': {'key': 'properties.registrationInfo', 'type': 'RegistrationInfoPatch'}, - 'vm_template': {'key': 'properties.vmTemplate', 'type': 'str'}, - 'ssoadfs_authority': {'key': 'properties.ssoadfsAuthority', 'type': 'str'}, - 'sso_client_id': {'key': 'properties.ssoClientId', 'type': 'str'}, - 'sso_client_secret_key_vault_path': {'key': 'properties.ssoClientSecretKeyVaultPath', 'type': 'str'}, - 'sso_secret_type': {'key': 'properties.ssoSecretType', 'type': 'str'}, - 'preferred_app_group_type': {'key': 'properties.preferredAppGroupType', 'type': 'str'}, - 'start_vm_on_connect': {'key': 'properties.startVMOnConnect', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(HostPoolPatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.description = kwargs.get('description', None) - self.custom_rdp_property = kwargs.get('custom_rdp_property', None) - self.max_session_limit = kwargs.get('max_session_limit', None) - self.personal_desktop_assignment_type = kwargs.get('personal_desktop_assignment_type', None) - self.load_balancer_type = kwargs.get('load_balancer_type', None) - self.ring = kwargs.get('ring', None) - self.validation_environment = kwargs.get('validation_environment', None) - self.registration_info = kwargs.get('registration_info', None) - self.vm_template = kwargs.get('vm_template', None) - self.ssoadfs_authority = kwargs.get('ssoadfs_authority', None) - self.sso_client_id = kwargs.get('sso_client_id', None) - self.sso_client_secret_key_vault_path = kwargs.get('sso_client_secret_key_vault_path', None) - self.sso_secret_type = kwargs.get('sso_secret_type', None) - self.preferred_app_group_type = kwargs.get('preferred_app_group_type', None) - self.start_vm_on_connect = kwargs.get('start_vm_on_connect', None) - self.public_network_access = kwargs.get('public_network_access', None) - - -class Identity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Identity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class LogSpecification(msrest.serialization.Model): - """Specifications of the Log for Azure Monitoring. - - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.blob_duration = kwargs.get('blob_duration', None) - - -class MigrationRequestProperties(msrest.serialization.Model): - """Properties for arm migration. - - :param operation: The type of operation for migration. Possible values include: "Start", - "Revoke", "Complete", "Hide", "Unhide". - :type operation: str or ~desktop_virtualization_api_client.models.Operation - :param migration_path: The path to the legacy object to migrate. - :type migration_path: str - """ - - _attribute_map = { - 'operation': {'key': 'operation', 'type': 'str'}, - 'migration_path': {'key': 'migrationPath', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MigrationRequestProperties, self).__init__(**kwargs) - self.operation = kwargs.get('operation', None) - self.migration_path = kwargs.get('migration_path', None) - - -class MSIXImageURI(msrest.serialization.Model): - """Represents URI referring to MSIX Image. - - :param uri: URI to Image. - :type uri: str - """ - - _attribute_map = { - 'uri': {'key': 'uri', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MSIXImageURI, self).__init__(**kwargs) - self.uri = kwargs.get('uri', None) - - -class MSIXPackage(Resource): - """Schema for MSIX Package properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :param image_path: VHD/CIM image path on Network Share. - :type image_path: str - :param package_name: Package Name from appxmanifest.xml. - :type package_name: str - :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name - and Publisher name. - :type package_family_name: str - :param display_name: User friendly Name to be displayed in the portal. - :type display_name: str - :param package_relative_path: Relative Path to the package inside the image. - :type package_relative_path: str - :param is_regular_registration: Specifies how to register Package in feed. - :type is_regular_registration: bool - :param is_active: Make this version of the package the active one across the hostpool. - :type is_active: bool - :param package_dependencies: List of package dependencies. - :type package_dependencies: - list[~desktop_virtualization_api_client.models.MsixPackageDependencies] - :param version: Package Version found in the appxmanifest.xml. - :type version: str - :param last_updated: Date Package was last updated, found in the appxmanifest.xml. - :type last_updated: ~datetime.datetime - :param package_applications: List of package applications. - :type package_applications: - list[~desktop_virtualization_api_client.models.MsixPackageApplications] - """ - - _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'}, - 'image_path': {'key': 'properties.imagePath', 'type': 'str'}, - 'package_name': {'key': 'properties.packageName', 'type': 'str'}, - 'package_family_name': {'key': 'properties.packageFamilyName', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'package_relative_path': {'key': 'properties.packageRelativePath', 'type': 'str'}, - 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, - 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, - 'package_dependencies': {'key': 'properties.packageDependencies', 'type': '[MsixPackageDependencies]'}, - 'version': {'key': 'properties.version', 'type': 'str'}, - 'last_updated': {'key': 'properties.lastUpdated', 'type': 'iso-8601'}, - 'package_applications': {'key': 'properties.packageApplications', 'type': '[MsixPackageApplications]'}, - } - - def __init__( - self, - **kwargs - ): - super(MSIXPackage, self).__init__(**kwargs) - self.system_data = None - self.image_path = kwargs.get('image_path', None) - self.package_name = kwargs.get('package_name', None) - self.package_family_name = kwargs.get('package_family_name', None) - self.display_name = kwargs.get('display_name', None) - self.package_relative_path = kwargs.get('package_relative_path', None) - self.is_regular_registration = kwargs.get('is_regular_registration', None) - self.is_active = kwargs.get('is_active', None) - self.package_dependencies = kwargs.get('package_dependencies', None) - self.version = kwargs.get('version', None) - self.last_updated = kwargs.get('last_updated', None) - self.package_applications = kwargs.get('package_applications', None) - - -class MsixPackageApplications(msrest.serialization.Model): - """Schema for MSIX Package Application properties. - - :param app_id: Package Application Id, found in appxmanifest.xml. - :type app_id: str - :param description: Description of Package Application. - :type description: str - :param app_user_model_id: Used to activate Package Application. Consists of Package Name and - ApplicationID. Found in appxmanifest.xml. - :type app_user_model_id: str - :param friendly_name: User friendly name. - :type friendly_name: str - :param icon_image_name: User friendly name. - :type icon_image_name: str - :param raw_icon: the icon a 64 bit string as a byte array. - :type raw_icon: bytearray - :param raw_png: the icon a 64 bit string as a byte array. - :type raw_png: bytearray - """ - - _attribute_map = { - 'app_id': {'key': 'appId', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'app_user_model_id': {'key': 'appUserModelID', 'type': 'str'}, - 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, - 'icon_image_name': {'key': 'iconImageName', 'type': 'str'}, - 'raw_icon': {'key': 'rawIcon', 'type': 'bytearray'}, - 'raw_png': {'key': 'rawPng', 'type': 'bytearray'}, - } - - def __init__( - self, - **kwargs - ): - super(MsixPackageApplications, self).__init__(**kwargs) - self.app_id = kwargs.get('app_id', None) - self.description = kwargs.get('description', None) - self.app_user_model_id = kwargs.get('app_user_model_id', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.icon_image_name = kwargs.get('icon_image_name', None) - self.raw_icon = kwargs.get('raw_icon', None) - self.raw_png = kwargs.get('raw_png', None) - - -class MsixPackageDependencies(msrest.serialization.Model): - """Schema for MSIX Package Dependencies properties. - - :param dependency_name: Name of package dependency. - :type dependency_name: str - :param publisher: Name of dependency publisher. - :type publisher: str - :param min_version: Dependency version required. - :type min_version: str - """ - - _attribute_map = { - 'dependency_name': {'key': 'dependencyName', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'min_version': {'key': 'minVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MsixPackageDependencies, self).__init__(**kwargs) - self.dependency_name = kwargs.get('dependency_name', None) - self.publisher = kwargs.get('publisher', None) - self.min_version = kwargs.get('min_version', None) - - -class MSIXPackageList(msrest.serialization.Model): - """List of MSIX Package definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of MSIX Package definitions. - :type value: list[~desktop_virtualization_api_client.models.MSIXPackage] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[MSIXPackage]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MSIXPackageList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class MSIXPackagePatch(Resource): - """MSIX Package properties that can be patched. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param is_active: Set a version of the package to be active across hostpool. - :type is_active: bool - :param is_regular_registration: Set Registration mode. Regular or Delayed. - :type is_regular_registration: bool - :param display_name: Display name for MSIX Package. - :type display_name: 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'}, - 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, - 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MSIXPackagePatch, self).__init__(**kwargs) - self.is_active = kwargs.get('is_active', None) - self.is_regular_registration = kwargs.get('is_regular_registration', None) - self.display_name = kwargs.get('display_name', None) - - -class OperationProperties(msrest.serialization.Model): - """Properties of the operation. - - :param service_specification: Service specification payload. - :type service_specification: ~desktop_virtualization_api_client.models.ServiceSpecification - """ - - _attribute_map = { - 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationProperties, self).__init__(**kwargs) - self.service_specification = kwargs.get('service_specification', None) - - -class Plan(msrest.serialization.Model): - """Plan for the resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. - :type name: str - :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. - NewRelic. - :type publisher: str - :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product - maps to the OfferID specified for the artifact at the time of Data Market onboarding. - :type product: str - :param promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :type promotion_code: str - :param version: The version of the desired product/artifact. - :type version: str - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Plan, self).__init__(**kwargs) - self.name = kwargs['name'] - self.publisher = kwargs['publisher'] - self.product = kwargs['product'] - self.promotion_code = kwargs.get('promotion_code', None) - self.version = kwargs.get('version', None) - - -class PrivateEndpoint(msrest.serialization.Model): - """The Private Endpoint resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM identifier for Private Endpoint. - :vartype id: str - """ - - _validation = { - 'id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpoint, self).__init__(**kwargs) - self.id = None - - -class PrivateEndpointConnection(Resource): - """The Private Endpoint Connection 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. 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 - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState - :param provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :type provisioning_state: str or - ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState - """ - - _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'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnection, self).__init__(**kwargs) - self.private_endpoint = kwargs.get('private_endpoint', None) - self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) - self.provisioning_state = kwargs.get('provisioning_state', None) - - -class PrivateEndpointConnectionListResultWithSystemData(msrest.serialization.Model): - """List of private endpoint connection associated with the specified storage account. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: Array of private endpoint connections. - :type value: - list[~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionWithSystemData]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionListResultWithSystemData, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): - """The Private Endpoint Connection 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. 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 - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState - :param provisioning_state: The provisioning state of the private endpoint connection resource. - Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :type provisioning_state: str or - ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.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'}, - 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, - 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateEndpointConnectionWithSystemData, self).__init__(**kwargs) - self.system_data = None - - -class PrivateLinkResource(Resource): - """A private link 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. 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 group_id: The private link resource group id. - :vartype group_id: str - :ivar required_members: The private link resource required member names. - :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'group_id': {'readonly': True}, - 'required_members': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'group_id': {'key': 'properties.groupId', 'type': 'str'}, - 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, - 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResource, self).__init__(**kwargs) - self.group_id = None - self.required_members = None - self.required_zone_names = kwargs.get('required_zone_names', None) - - -class PrivateLinkResourceListResult(msrest.serialization.Model): - """A list of private link resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: Array of private link resources. - :type value: list[~desktop_virtualization_api_client.models.PrivateLinkResource] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkResourceListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class PrivateLinkServiceConnectionState(msrest.serialization.Model): - """A collection of information about the state of the connection between service consumer and provider. - - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner - of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~desktop_virtualization_api_client.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any - updates on the consumer. - :type actions_required: str - """ - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) - self.status = kwargs.get('status', None) - self.description = kwargs.get('description', None) - self.actions_required = kwargs.get('actions_required', None) - - -class RegistrationInfo(msrest.serialization.Model): - """Represents a RegistrationInfo definition. - - :param expiration_time: Expiration time of registration token. - :type expiration_time: ~datetime.datetime - :param token: The registration token base64 encoded string. - :type token: str - :param registration_token_operation: The type of resetting the token. Possible values include: - "Delete", "None", "Update". - :type registration_token_operation: str or - ~desktop_virtualization_api_client.models.RegistrationTokenOperation - """ - - _attribute_map = { - 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, - 'token': {'key': 'token', 'type': 'str'}, - 'registration_token_operation': {'key': 'registrationTokenOperation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistrationInfo, self).__init__(**kwargs) - self.expiration_time = kwargs.get('expiration_time', None) - self.token = kwargs.get('token', None) - self.registration_token_operation = kwargs.get('registration_token_operation', None) - - -class RegistrationInfoPatch(msrest.serialization.Model): - """Represents a RegistrationInfo definition. - - :param expiration_time: Expiration time of registration token. - :type expiration_time: ~datetime.datetime - :param registration_token_operation: The type of resetting the token. Possible values include: - "Delete", "None", "Update". - :type registration_token_operation: str or - ~desktop_virtualization_api_client.models.RegistrationTokenOperation - """ - - _attribute_map = { - 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, - 'registration_token_operation': {'key': 'registrationTokenOperation', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(RegistrationInfoPatch, self).__init__(**kwargs) - self.expiration_time = kwargs.get('expiration_time', None) - self.registration_token_operation = kwargs.get('registration_token_operation', None) - - -class ResourceModelWithAllowedPropertySetIdentity(Identity): - """ResourceModelWithAllowedPropertySetIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and - "SystemAssigned". The default value is None. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceModelWithAllowedPropertySetIdentity, self).__init__(**kwargs) - - -class ResourceModelWithAllowedPropertySetPlan(Plan): - """ResourceModelWithAllowedPropertySetPlan. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. - :type name: str - :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. - NewRelic. - :type publisher: str - :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product - maps to the OfferID specified for the artifact at the time of Data Market onboarding. - :type product: str - :param promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :type promotion_code: str - :param version: The version of the desired product/artifact. - :type version: str - """ - - _validation = { - 'name': {'required': True}, - 'publisher': {'required': True}, - 'product': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'publisher': {'key': 'publisher', 'type': 'str'}, - 'product': {'key': 'product', 'type': 'str'}, - 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, - 'version': {'key': 'version', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceModelWithAllowedPropertySetPlan, self).__init__(**kwargs) - - -class Sku(msrest.serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. - :type name: str - :param tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", - "Standard", "Premium". - :type tier: str or ~desktop_virtualization_api_client.models.SkuTier - :param size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :type size: str - :param family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :type family: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :type capacity: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Sku, self).__init__(**kwargs) - self.name = kwargs['name'] - self.tier = kwargs.get('tier', None) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) - self.capacity = kwargs.get('capacity', None) - - -class ResourceModelWithAllowedPropertySetSku(Sku): - """ResourceModelWithAllowedPropertySetSku. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. - :type name: str - :param tier: This field is required to be implemented by the Resource Provider if the service - has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", - "Standard", "Premium". - :type tier: str or ~desktop_virtualization_api_client.models.SkuTier - :param size: The SKU size. When the name field is the combination of tier and some other value, - this would be the standalone code. - :type size: str - :param family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :type family: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. - If scale out/in is not possible for the resource this may be omitted. - :type capacity: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'tier': {'key': 'tier', 'type': 'str'}, - 'size': {'key': 'size', 'type': 'str'}, - 'family': {'key': 'family', 'type': 'str'}, - 'capacity': {'key': 'capacity', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceModelWithAllowedPropertySetSku, self).__init__(**kwargs) - - -class ResourceProviderOperation(msrest.serialization.Model): - """Supported operation of this resource provider. - - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~desktop_virtualization_api_client.models.ResourceProviderOperationDisplay - :param is_data_action: Is a data action. - :type is_data_action: bool - :param properties: Properties of the operation. - :type properties: ~desktop_virtualization_api_client.models.OperationProperties - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'properties': {'key': 'properties', 'type': 'OperationProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.properties = kwargs.get('properties', None) - - -class ResourceProviderOperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Resource provider: Microsoft Desktop Virtualization. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class ResourceProviderOperationList(msrest.serialization.Model): - """Result of the request to list operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by this resource provider. - :type value: list[~desktop_virtualization_api_client.models.ResourceProviderOperation] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceProviderOperationList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ScalingHostPoolReference(msrest.serialization.Model): - """Scaling plan reference to hostpool. - - :param host_pool_arm_path: Arm path of referenced hostpool. - :type host_pool_arm_path: str - :param scaling_plan_enabled: Is the scaling plan enabled for this hostpool. - :type scaling_plan_enabled: bool - """ - - _attribute_map = { - 'host_pool_arm_path': {'key': 'hostPoolArmPath', 'type': 'str'}, - 'scaling_plan_enabled': {'key': 'scalingPlanEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ScalingHostPoolReference, self).__init__(**kwargs) - self.host_pool_arm_path = kwargs.get('host_pool_arm_path', None) - self.scaling_plan_enabled = kwargs.get('scaling_plan_enabled', None) - - -class ScalingPlan(ResourceModelWithAllowedPropertySet): - """Represents a scaling plan definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. - Indicates if this resource is managed by another Azure resource. If this is present, complete - mode deployment will not delete the resource if it is removed from the template since it is - managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :type kind: str - :ivar etag: The etag field is *not* required. If it is provided in the response body, it must - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - (section 14.27) header fields. - :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of scaling plan. (internal use). - :vartype object_id: str - :param description: Description of scaling plan. - :type description: str - :param friendly_name: User friendly name of scaling plan. - :type friendly_name: str - :param time_zone: Timezone of the scaling plan. - :type time_zone: str - :param host_pool_type: HostPool type for desktop. Possible values include: "Pooled". - :type host_pool_type: str or ~desktop_virtualization_api_client.models.ScalingHostPoolType - :param exclusion_tag: Exclusion tag for scaling plan. - :type exclusion_tag: str - :param schedules: List of ScalingSchedule definitions. - :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] - :param host_pool_references: List of ScalingHostPoolReference definitions. - :type host_pool_references: - list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, - 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, - 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'host_pool_type': {'key': 'properties.hostPoolType', 'type': 'str'}, - 'exclusion_tag': {'key': 'properties.exclusionTag', 'type': 'str'}, - 'schedules': {'key': 'properties.schedules', 'type': '[ScalingSchedule]'}, - 'host_pool_references': {'key': 'properties.hostPoolReferences', 'type': '[ScalingHostPoolReference]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScalingPlan, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.time_zone = kwargs.get('time_zone', None) - self.host_pool_type = kwargs.get('host_pool_type', None) - self.exclusion_tag = kwargs.get('exclusion_tag', None) - self.schedules = kwargs.get('schedules', None) - self.host_pool_references = kwargs.get('host_pool_references', None) - - -class ScalingPlanList(msrest.serialization.Model): - """List of scaling plan definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of scaling plan definitions. - :type value: list[~desktop_virtualization_api_client.models.ScalingPlan] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ScalingPlan]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScalingPlanList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ScalingPlanPatch(msrest.serialization.Model): - """Scaling plan properties that can be patched. - - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of scaling plan. - :type description: str - :param friendly_name: User friendly name of scaling plan. - :type friendly_name: str - :param time_zone: Timezone of the scaling plan. - :type time_zone: str - :param exclusion_tag: Exclusion tag for scaling plan. - :type exclusion_tag: str - :param schedules: List of ScalingSchedule definitions. - :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] - :param host_pool_references: List of ScalingHostPoolReference definitions. - :type host_pool_references: - list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, - 'exclusion_tag': {'key': 'properties.exclusionTag', 'type': 'str'}, - 'schedules': {'key': 'properties.schedules', 'type': '[ScalingSchedule]'}, - 'host_pool_references': {'key': 'properties.hostPoolReferences', 'type': '[ScalingHostPoolReference]'}, - } - - def __init__( - self, - **kwargs - ): - super(ScalingPlanPatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.time_zone = kwargs.get('time_zone', None) - self.exclusion_tag = kwargs.get('exclusion_tag', None) - self.schedules = kwargs.get('schedules', None) - self.host_pool_references = kwargs.get('host_pool_references', None) - - -class ScalingSchedule(msrest.serialization.Model): - """Scaling plan schedule. - - :param name: Name of the scaling schedule. - :type name: str - :param days_of_week: Set of days of the week on which this schedule is active. - :type days_of_week: list[str or - ~desktop_virtualization_api_client.models.ScalingScheduleDaysOfWeekItem] - :param ramp_up_start_time: Starting time for ramp up period. - :type ramp_up_start_time: ~desktop_virtualization_api_client.models.Time - :param ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Possible - values include: "BreadthFirst", "DepthFirst". - :type ramp_up_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm - :param ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. - :type ramp_up_minimum_hosts_pct: int - :param ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. - :type ramp_up_capacity_threshold_pct: int - :param peak_start_time: Starting time for peak period. - :type peak_start_time: ~desktop_virtualization_api_client.models.Time - :param peak_load_balancing_algorithm: Load balancing algorithm for peak period. Possible values - include: "BreadthFirst", "DepthFirst". - :type peak_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm - :param ramp_down_start_time: Starting time for ramp down period. - :type ramp_down_start_time: ~desktop_virtualization_api_client.models.Time - :param ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. - Possible values include: "BreadthFirst", "DepthFirst". - :type ramp_down_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm - :param ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. - :type ramp_down_minimum_hosts_pct: int - :param ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. - :type ramp_down_capacity_threshold_pct: int - :param ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. - :type ramp_down_force_logoff_users: bool - :param ramp_down_stop_hosts_when: Specifies when to stop hosts during ramp down period. - Possible values include: "ZeroSessions", "ZeroActiveSessions". - :type ramp_down_stop_hosts_when: str or ~desktop_virtualization_api_client.models.StopHostsWhen - :param ramp_down_wait_time_minutes: Number of minutes to wait to stop hosts during ramp down - period. - :type ramp_down_wait_time_minutes: int - :param ramp_down_notification_message: Notification message for users during ramp down period. - :type ramp_down_notification_message: str - :param off_peak_start_time: Starting time for off-peak period. - :type off_peak_start_time: ~desktop_virtualization_api_client.models.Time - :param off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. - Possible values include: "BreadthFirst", "DepthFirst". - :type off_peak_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm - """ - - _validation = { - 'ramp_up_minimum_hosts_pct': {'maximum': 100, 'minimum': 0}, - 'ramp_up_capacity_threshold_pct': {'maximum': 100, 'minimum': 1}, - 'ramp_down_minimum_hosts_pct': {'maximum': 100, 'minimum': 0}, - 'ramp_down_capacity_threshold_pct': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'days_of_week': {'key': 'daysOfWeek', 'type': '[str]'}, - 'ramp_up_start_time': {'key': 'rampUpStartTime', 'type': 'Time'}, - 'ramp_up_load_balancing_algorithm': {'key': 'rampUpLoadBalancingAlgorithm', 'type': 'str'}, - 'ramp_up_minimum_hosts_pct': {'key': 'rampUpMinimumHostsPct', 'type': 'int'}, - 'ramp_up_capacity_threshold_pct': {'key': 'rampUpCapacityThresholdPct', 'type': 'int'}, - 'peak_start_time': {'key': 'peakStartTime', 'type': 'Time'}, - 'peak_load_balancing_algorithm': {'key': 'peakLoadBalancingAlgorithm', 'type': 'str'}, - 'ramp_down_start_time': {'key': 'rampDownStartTime', 'type': 'Time'}, - 'ramp_down_load_balancing_algorithm': {'key': 'rampDownLoadBalancingAlgorithm', 'type': 'str'}, - 'ramp_down_minimum_hosts_pct': {'key': 'rampDownMinimumHostsPct', 'type': 'int'}, - 'ramp_down_capacity_threshold_pct': {'key': 'rampDownCapacityThresholdPct', 'type': 'int'}, - 'ramp_down_force_logoff_users': {'key': 'rampDownForceLogoffUsers', 'type': 'bool'}, - 'ramp_down_stop_hosts_when': {'key': 'rampDownStopHostsWhen', 'type': 'str'}, - 'ramp_down_wait_time_minutes': {'key': 'rampDownWaitTimeMinutes', 'type': 'int'}, - 'ramp_down_notification_message': {'key': 'rampDownNotificationMessage', 'type': 'str'}, - 'off_peak_start_time': {'key': 'offPeakStartTime', 'type': 'Time'}, - 'off_peak_load_balancing_algorithm': {'key': 'offPeakLoadBalancingAlgorithm', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ScalingSchedule, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.days_of_week = kwargs.get('days_of_week', None) - self.ramp_up_start_time = kwargs.get('ramp_up_start_time', None) - self.ramp_up_load_balancing_algorithm = kwargs.get('ramp_up_load_balancing_algorithm', None) - self.ramp_up_minimum_hosts_pct = kwargs.get('ramp_up_minimum_hosts_pct', None) - self.ramp_up_capacity_threshold_pct = kwargs.get('ramp_up_capacity_threshold_pct', None) - self.peak_start_time = kwargs.get('peak_start_time', None) - self.peak_load_balancing_algorithm = kwargs.get('peak_load_balancing_algorithm', None) - self.ramp_down_start_time = kwargs.get('ramp_down_start_time', None) - self.ramp_down_load_balancing_algorithm = kwargs.get('ramp_down_load_balancing_algorithm', None) - self.ramp_down_minimum_hosts_pct = kwargs.get('ramp_down_minimum_hosts_pct', None) - self.ramp_down_capacity_threshold_pct = kwargs.get('ramp_down_capacity_threshold_pct', None) - self.ramp_down_force_logoff_users = kwargs.get('ramp_down_force_logoff_users', None) - self.ramp_down_stop_hosts_when = kwargs.get('ramp_down_stop_hosts_when', None) - self.ramp_down_wait_time_minutes = kwargs.get('ramp_down_wait_time_minutes', None) - self.ramp_down_notification_message = kwargs.get('ramp_down_notification_message', None) - self.off_peak_start_time = kwargs.get('off_peak_start_time', None) - self.off_peak_load_balancing_algorithm = kwargs.get('off_peak_load_balancing_algorithm', None) - - -class SendMessage(msrest.serialization.Model): - """Represents message sent to a UserSession. - - :param message_title: Title of message. - :type message_title: str - :param message_body: Body of message. - :type message_body: str - """ - - _attribute_map = { - 'message_title': {'key': 'messageTitle', 'type': 'str'}, - 'message_body': {'key': 'messageBody', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SendMessage, self).__init__(**kwargs) - self.message_title = kwargs.get('message_title', None) - self.message_body = kwargs.get('message_body', None) - - -class ServiceSpecification(msrest.serialization.Model): - """Service specification payload. - - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: list[~desktop_virtualization_api_client.models.LogSpecification] - """ - - _attribute_map = { - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.log_specifications = kwargs.get('log_specifications', None) - - -class SessionHost(Resource): - """Represents a SessionHost definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of SessionHost. (internal use). - :vartype object_id: str - :param last_heart_beat: Last heart beat from SessionHost. - :type last_heart_beat: ~datetime.datetime - :param sessions: Number of sessions on SessionHost. - :type sessions: int - :param agent_version: Version of agent on SessionHost. - :type agent_version: str - :param allow_new_session: Allow a new session. - :type allow_new_session: bool - :ivar virtual_machine_id: Virtual Machine Id of SessionHost's underlying virtual machine. - :vartype virtual_machine_id: str - :ivar resource_id: Resource Id of SessionHost's underlying virtual machine. - :vartype resource_id: str - :param assigned_user: User assigned to SessionHost. - :type assigned_user: str - :param status: Status for a SessionHost. Possible values include: "Available", "Unavailable", - "Shutdown", "Disconnected", "Upgrading", "UpgradeFailed", "NoHeartbeat", "NotJoinedToDomain", - "DomainTrustRelationshipLost", "SxSStackListenerNotReady", "FSLogixNotHealthy", - "NeedsAssistance". - :type status: str or ~desktop_virtualization_api_client.models.Status - :ivar status_timestamp: The timestamp of the status. - :vartype status_timestamp: ~datetime.datetime - :param os_version: The version of the OS on the session host. - :type os_version: str - :param sx_s_stack_version: The version of the side by side stack on the session host. - :type sx_s_stack_version: str - :param update_state: Update state of a SessionHost. Possible values include: "Initial", - "Pending", "Started", "Succeeded", "Failed". - :type update_state: str or ~desktop_virtualization_api_client.models.UpdateState - :ivar last_update_time: The timestamp of the last update. - :vartype last_update_time: ~datetime.datetime - :param update_error_message: The error message. - :type update_error_message: str - :ivar session_host_health_check_results: List of SessionHostHealthCheckReports. - :vartype session_host_health_check_results: - list[~desktop_virtualization_api_client.models.SessionHostHealthCheckReport] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'readonly': True}, - 'virtual_machine_id': {'readonly': True}, - 'resource_id': {'readonly': True}, - 'status_timestamp': {'readonly': True}, - 'last_update_time': {'readonly': True}, - 'session_host_health_check_results': {'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'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'iso-8601'}, - 'sessions': {'key': 'properties.sessions', 'type': 'int'}, - 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, - 'allow_new_session': {'key': 'properties.allowNewSession', 'type': 'bool'}, - 'virtual_machine_id': {'key': 'properties.virtualMachineId', 'type': 'str'}, - 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, - 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'status_timestamp': {'key': 'properties.statusTimestamp', 'type': 'iso-8601'}, - 'os_version': {'key': 'properties.osVersion', 'type': 'str'}, - 'sx_s_stack_version': {'key': 'properties.sxSStackVersion', 'type': 'str'}, - 'update_state': {'key': 'properties.updateState', 'type': 'str'}, - 'last_update_time': {'key': 'properties.lastUpdateTime', 'type': 'iso-8601'}, - 'update_error_message': {'key': 'properties.updateErrorMessage', 'type': 'str'}, - 'session_host_health_check_results': {'key': 'properties.sessionHostHealthCheckResults', 'type': '[SessionHostHealthCheckReport]'}, - } - - def __init__( - self, - **kwargs - ): - super(SessionHost, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.last_heart_beat = kwargs.get('last_heart_beat', None) - self.sessions = kwargs.get('sessions', None) - self.agent_version = kwargs.get('agent_version', None) - self.allow_new_session = kwargs.get('allow_new_session', None) - self.virtual_machine_id = None - self.resource_id = None - self.assigned_user = kwargs.get('assigned_user', None) - self.status = kwargs.get('status', None) - self.status_timestamp = None - self.os_version = kwargs.get('os_version', None) - self.sx_s_stack_version = kwargs.get('sx_s_stack_version', None) - self.update_state = kwargs.get('update_state', None) - self.last_update_time = None - self.update_error_message = kwargs.get('update_error_message', None) - self.session_host_health_check_results = None - - -class SessionHostHealthCheckFailureDetails(msrest.serialization.Model): - """Contains details on the failure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar message: Failure message: hints on what is wrong and how to recover. - :vartype message: str - :ivar error_code: Error code corresponding for the failure. - :vartype error_code: int - :ivar last_health_check_date_time: The timestamp of the last update. - :vartype last_health_check_date_time: ~datetime.datetime - """ - - _validation = { - 'message': {'readonly': True}, - 'error_code': {'readonly': True}, - 'last_health_check_date_time': {'readonly': True}, - } - - _attribute_map = { - 'message': {'key': 'message', 'type': 'str'}, - 'error_code': {'key': 'errorCode', 'type': 'int'}, - 'last_health_check_date_time': {'key': 'lastHealthCheckDateTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SessionHostHealthCheckFailureDetails, self).__init__(**kwargs) - self.message = None - self.error_code = None - self.last_health_check_date_time = None - - -class SessionHostHealthCheckReport(msrest.serialization.Model): - """The report for session host information. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar health_check_name: Represents the name of the health check operation performed. Possible - values include: "DomainJoinedCheck", "DomainTrustCheck", "FSLogixHealthCheck", - "SxSStackListenerCheck", "UrlsAccessibleCheck", "MonitoringAgentCheck", "DomainReachable", - "WebRTCRedirectorCheck", "SupportedEncryptionCheck", "MetaDataServiceCheck", - "AppAttachHealthCheck". - :vartype health_check_name: str or ~desktop_virtualization_api_client.models.HealthCheckName - :ivar health_check_result: Represents the Health state of the health check we performed. - Possible values include: "Unknown", "HealthCheckSucceeded", "HealthCheckFailed", - "SessionHostShutdown". - :vartype health_check_result: str or - ~desktop_virtualization_api_client.models.HealthCheckResult - :ivar additional_failure_details: Additional detailed information on the failure. - :vartype additional_failure_details: - ~desktop_virtualization_api_client.models.SessionHostHealthCheckFailureDetails - """ - - _validation = { - 'health_check_name': {'readonly': True}, - 'health_check_result': {'readonly': True}, - 'additional_failure_details': {'readonly': True}, - } - - _attribute_map = { - 'health_check_name': {'key': 'healthCheckName', 'type': 'str'}, - 'health_check_result': {'key': 'healthCheckResult', 'type': 'str'}, - 'additional_failure_details': {'key': 'additionalFailureDetails', 'type': 'SessionHostHealthCheckFailureDetails'}, - } - - def __init__( - self, - **kwargs - ): - super(SessionHostHealthCheckReport, self).__init__(**kwargs) - self.health_check_name = None - self.health_check_result = None - self.additional_failure_details = None - - -class SessionHostList(msrest.serialization.Model): - """List of SessionHost definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of SessionHost definitions. - :type value: list[~desktop_virtualization_api_client.models.SessionHost] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SessionHost]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SessionHostList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class SessionHostPatch(Resource): - """SessionHost properties that can be patched. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param allow_new_session: Allow a new session. - :type allow_new_session: bool - :param assigned_user: User assigned to SessionHost. - :type assigned_user: 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'}, - 'allow_new_session': {'key': 'properties.allowNewSession', 'type': 'bool'}, - 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SessionHostPatch, self).__init__(**kwargs) - self.allow_new_session = kwargs.get('allow_new_session', None) - self.assigned_user = kwargs.get('assigned_user', None) - - -class StartMenuItem(Resource): - """Represents a StartMenuItem definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param app_alias: Alias of StartMenuItem. - :type app_alias: str - :param file_path: Path to the file of StartMenuItem. - :type file_path: str - :param command_line_arguments: Command line arguments for StartMenuItem. - :type command_line_arguments: str - :param icon_path: Path to the icon. - :type icon_path: str - :param icon_index: Index of the icon. - :type icon_index: int - """ - - _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'}, - 'app_alias': {'key': 'properties.appAlias', 'type': 'str'}, - 'file_path': {'key': 'properties.filePath', 'type': 'str'}, - 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, - 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, - 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(StartMenuItem, self).__init__(**kwargs) - self.app_alias = kwargs.get('app_alias', None) - self.file_path = kwargs.get('file_path', None) - self.command_line_arguments = kwargs.get('command_line_arguments', None) - self.icon_path = kwargs.get('icon_path', None) - self.icon_index = kwargs.get('icon_index', None) - - -class StartMenuItemList(msrest.serialization.Model): - """List of StartMenuItem definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of StartMenuItem definitions. - :type value: list[~desktop_virtualization_api_client.models.StartMenuItem] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[StartMenuItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StartMenuItemList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type 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, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Time(msrest.serialization.Model): - """The time for a scaling action to occur. - - All required parameters must be populated in order to send to Azure. - - :param hour: Required. The hour. - :type hour: int - :param minute: Required. The minute. - :type minute: int - """ - - _validation = { - 'hour': {'required': True, 'maximum': 23, 'minimum': 0}, - 'minute': {'required': True, 'maximum': 59, 'minimum': 0}, - } - - _attribute_map = { - 'hour': {'key': 'hour', 'type': 'int'}, - 'minute': {'key': 'minute', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(Time, self).__init__(**kwargs) - self.hour = kwargs['hour'] - self.minute = kwargs['minute'] - - -class UserSession(Resource): - """Represents a UserSession definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of user session. (internal use). - :vartype object_id: str - :param user_principal_name: The user principal name. - :type user_principal_name: str - :param application_type: Application type of application. Possible values include: "RemoteApp", - "Desktop". - :type application_type: str or ~desktop_virtualization_api_client.models.ApplicationType - :param session_state: State of user session. Possible values include: "Unknown", "Active", - "Disconnected", "Pending", "LogOff", "UserProfileDiskMounted". - :type session_state: str or ~desktop_virtualization_api_client.models.SessionState - :param active_directory_user_name: The active directory user name. - :type active_directory_user_name: str - :param create_time: The timestamp of the user session create. - :type create_time: ~datetime.datetime - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'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'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'user_principal_name': {'key': 'properties.userPrincipalName', 'type': 'str'}, - 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, - 'session_state': {'key': 'properties.sessionState', 'type': 'str'}, - 'active_directory_user_name': {'key': 'properties.activeDirectoryUserName', 'type': 'str'}, - 'create_time': {'key': 'properties.createTime', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(UserSession, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.user_principal_name = kwargs.get('user_principal_name', None) - self.application_type = kwargs.get('application_type', None) - self.session_state = kwargs.get('session_state', None) - self.active_directory_user_name = kwargs.get('active_directory_user_name', None) - self.create_time = kwargs.get('create_time', None) - - -class UserSessionList(msrest.serialization.Model): - """List of UserSession definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of UserSession definitions. - :type value: list[~desktop_virtualization_api_client.models.UserSession] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[UserSession]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserSessionList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class Workspace(ResourceModelWithAllowedPropertySet): - """Represents a Workspace definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :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 - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. - Indicates if this resource is managed by another Azure resource. If this is present, complete - mode deployment will not delete the resource if it is removed from the template since it is - managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for - resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, - the resource provider must validate and persist this value. - :type kind: str - :ivar etag: The etag field is *not* required. If it is provided in the response body, it must - also be provided as a header per the normal etag convention. Entity tags are used for - comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in - the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - (section 14.27) header fields. - :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :ivar object_id: ObjectId of Workspace. (internal use). - :vartype object_id: str - :param description: Description of Workspace. - :type description: str - :param friendly_name: Friendly name of Workspace. - :type friendly_name: str - :param application_group_references: List of applicationGroup resource Ids. - :type application_group_references: list[str] - :ivar cloud_pc_resource: Is cloud pc resource. - :vartype cloud_pc_resource: bool - :param public_network_access: Enabled allows this resource to be accessed from both public and - private networks, Disabled allows this resource to only be accessed via private endpoints. - Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'object_id': {'readonly': True}, - 'cloud_pc_resource': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'managed_by': {'key': 'managedBy', 'type': 'str'}, - 'kind': {'key': 'kind', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, - 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, - 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'object_id': {'key': 'properties.objectId', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, - 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Workspace, self).__init__(**kwargs) - self.system_data = None - self.object_id = None - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.application_group_references = kwargs.get('application_group_references', None) - self.cloud_pc_resource = None - self.public_network_access = kwargs.get('public_network_access', None) - - -class WorkspaceList(msrest.serialization.Model): - """List of Workspace definitions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of Workspace definitions. - :type value: list[~desktop_virtualization_api_client.models.Workspace] - :ivar next_link: Link to the next page of results. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Workspace]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspaceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class WorkspacePatch(msrest.serialization.Model): - """Workspace properties that can be patched. - - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of Workspace. - :type description: str - :param friendly_name: Friendly name of Workspace. - :type friendly_name: str - :param application_group_references: List of applicationGroup links. - :type application_group_references: list[str] - :param public_network_access: Enabled to allow this resource to be access from the public - network. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, - 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, - 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(WorkspacePatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.description = kwargs.get('description', None) - self.friendly_name = kwargs.get('friendly_name', None) - self.application_group_references = kwargs.get('application_group_references', None) - self.public_network_access = kwargs.get('public_network_access', None) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py index 9af6a672aa43..3ccc58f631f9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py @@ -14,6 +14,116 @@ from ._desktop_virtualization_api_client_enums import * +class AgentUpdatePatchProperties(msrest.serialization.Model): + """The session host configuration for updating agent, monitoring agent, and stack component. + + :ivar type: The type of maintenance for session host components. Possible values include: + "Default", "Scheduled". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.SessionHostComponentUpdateType + :ivar use_session_host_local_time: Whether to use localTime of the virtual machine. + :vartype use_session_host_local_time: bool + :ivar maintenance_window_time_zone: Time zone for maintenance as defined in + https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. + Must be set if useLocalTime is true. + :vartype maintenance_window_time_zone: str + :ivar maintenance_windows: List of maintenance windows. Maintenance windows are 2 hours long. + :vartype maintenance_windows: + list[~azure.mgmt.desktopvirtualization.models.MaintenanceWindowPatchProperties] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'use_session_host_local_time': {'key': 'useSessionHostLocalTime', 'type': 'bool'}, + 'maintenance_window_time_zone': {'key': 'maintenanceWindowTimeZone', 'type': 'str'}, + 'maintenance_windows': {'key': 'maintenanceWindows', 'type': '[MaintenanceWindowPatchProperties]'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "SessionHostComponentUpdateType"]] = None, + use_session_host_local_time: Optional[bool] = None, + maintenance_window_time_zone: Optional[str] = None, + maintenance_windows: Optional[List["MaintenanceWindowPatchProperties"]] = None, + **kwargs + ): + """ + :keyword type: The type of maintenance for session host components. Possible values include: + "Default", "Scheduled". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.SessionHostComponentUpdateType + :keyword use_session_host_local_time: Whether to use localTime of the virtual machine. + :paramtype use_session_host_local_time: bool + :keyword maintenance_window_time_zone: Time zone for maintenance as defined in + https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. + Must be set if useLocalTime is true. + :paramtype maintenance_window_time_zone: str + :keyword maintenance_windows: List of maintenance windows. Maintenance windows are 2 hours + long. + :paramtype maintenance_windows: + list[~azure.mgmt.desktopvirtualization.models.MaintenanceWindowPatchProperties] + """ + super(AgentUpdatePatchProperties, self).__init__(**kwargs) + self.type = type + self.use_session_host_local_time = use_session_host_local_time + self.maintenance_window_time_zone = maintenance_window_time_zone + self.maintenance_windows = maintenance_windows + + +class AgentUpdateProperties(msrest.serialization.Model): + """The session host configuration for updating agent, monitoring agent, and stack component. + + :ivar type: The type of maintenance for session host components. Possible values include: + "Default", "Scheduled". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.SessionHostComponentUpdateType + :ivar use_session_host_local_time: Whether to use localTime of the virtual machine. + :vartype use_session_host_local_time: bool + :ivar maintenance_window_time_zone: Time zone for maintenance as defined in + https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. + Must be set if useLocalTime is true. + :vartype maintenance_window_time_zone: str + :ivar maintenance_windows: List of maintenance windows. Maintenance windows are 2 hours long. + :vartype maintenance_windows: + list[~azure.mgmt.desktopvirtualization.models.MaintenanceWindowProperties] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'use_session_host_local_time': {'key': 'useSessionHostLocalTime', 'type': 'bool'}, + 'maintenance_window_time_zone': {'key': 'maintenanceWindowTimeZone', 'type': 'str'}, + 'maintenance_windows': {'key': 'maintenanceWindows', 'type': '[MaintenanceWindowProperties]'}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "SessionHostComponentUpdateType"]] = None, + use_session_host_local_time: Optional[bool] = None, + maintenance_window_time_zone: Optional[str] = None, + maintenance_windows: Optional[List["MaintenanceWindowProperties"]] = None, + **kwargs + ): + """ + :keyword type: The type of maintenance for session host components. Possible values include: + "Default", "Scheduled". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.SessionHostComponentUpdateType + :keyword use_session_host_local_time: Whether to use localTime of the virtual machine. + :paramtype use_session_host_local_time: bool + :keyword maintenance_window_time_zone: Time zone for maintenance as defined in + https://docs.microsoft.com/en-us/dotnet/api/system.timezoneinfo.findsystemtimezonebyid?view=net-5.0. + Must be set if useLocalTime is true. + :paramtype maintenance_window_time_zone: str + :keyword maintenance_windows: List of maintenance windows. Maintenance windows are 2 hours + long. + :paramtype maintenance_windows: + list[~azure.mgmt.desktopvirtualization.models.MaintenanceWindowProperties] + """ + super(AgentUpdateProperties, self).__init__(**kwargs) + self.type = type + self.use_session_host_local_time = use_session_host_local_time + self.maintenance_window_time_zone = maintenance_window_time_zone + self.maintenance_windows = maintenance_windows + + class Resource(msrest.serialization.Model): """Common fields that are returned in the response for all Azure Resource Manager resources. @@ -45,6 +155,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -67,36 +179,38 @@ class Application(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Application. (internal use). :vartype object_id: str - :param description: Description of Application. - :type description: str - :param friendly_name: Friendly name of Application. - :type friendly_name: str - :param file_path: Specifies a path for the executable file for the application. - :type file_path: str - :param msix_package_family_name: Specifies the package family name for MSIX applications. - :type msix_package_family_name: str - :param msix_package_application_id: Specifies the package application Id for MSIX applications. - :type msix_package_application_id: str - :param application_type: Resource Type of Application. Possible values include: "InBuilt", + :ivar description: Description of Application. + :vartype description: str + :ivar friendly_name: Friendly name of Application. + :vartype friendly_name: str + :ivar file_path: Specifies a path for the executable file for the application. + :vartype file_path: str + :ivar msix_package_family_name: Specifies the package family name for MSIX applications. + :vartype msix_package_family_name: str + :ivar msix_package_application_id: Specifies the package application Id for MSIX applications. + :vartype msix_package_application_id: str + :ivar application_type: Resource Type of Application. Possible values include: "InBuilt", "MsixApplication". - :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType - :param command_line_setting: Required. Specifies whether this published application can be + :vartype application_type: str or + ~azure.mgmt.desktopvirtualization.models.RemoteApplicationType + :ivar command_line_setting: Required. Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. Possible values include: "DoNotAllow", "Allow", "Require". - :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting - :param command_line_arguments: Command Line Arguments for Application. - :type command_line_arguments: str - :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + :vartype command_line_setting: str or + ~azure.mgmt.desktopvirtualization.models.CommandLineSetting + :ivar command_line_arguments: Command Line Arguments for Application. + :vartype command_line_arguments: str + :ivar show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access server. - :type show_in_portal: bool - :param icon_path: Path to icon. - :type icon_path: str - :param icon_index: Index of the icon. - :type icon_index: int + :vartype show_in_portal: bool + :ivar icon_path: Path to icon. + :vartype icon_path: str + :ivar icon_index: Index of the icon. + :vartype icon_index: int :ivar icon_hash: Hash of the icon. :vartype icon_hash: str :ivar icon_content: the icon a 64 bit string as a byte array. @@ -151,6 +265,38 @@ def __init__( icon_index: Optional[int] = None, **kwargs ): + """ + :keyword description: Description of Application. + :paramtype description: str + :keyword friendly_name: Friendly name of Application. + :paramtype friendly_name: str + :keyword file_path: Specifies a path for the executable file for the application. + :paramtype file_path: str + :keyword msix_package_family_name: Specifies the package family name for MSIX applications. + :paramtype msix_package_family_name: str + :keyword msix_package_application_id: Specifies the package application Id for MSIX + applications. + :paramtype msix_package_application_id: str + :keyword application_type: Resource Type of Application. Possible values include: "InBuilt", + "MsixApplication". + :paramtype application_type: str or + ~azure.mgmt.desktopvirtualization.models.RemoteApplicationType + :keyword command_line_setting: Required. Specifies whether this published application can be + launched with command line arguments provided by the client, command line arguments specified + at publish time, or no command line arguments at all. Possible values include: "DoNotAllow", + "Allow", "Require". + :paramtype command_line_setting: str or + ~azure.mgmt.desktopvirtualization.models.CommandLineSetting + :keyword command_line_arguments: Command Line Arguments for Application. + :paramtype command_line_arguments: str + :keyword show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + server. + :paramtype show_in_portal: bool + :keyword icon_path: Path to icon. + :paramtype icon_path: str + :keyword icon_index: Index of the icon. + :paramtype icon_index: int + """ super(Application, self).__init__(**kwargs) self.system_data = None self.object_id = None @@ -182,32 +328,32 @@ class ResourceModelWithAllowedPropertySet(msrest.serialization.Model): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + :vartype managed_by: str + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - :type kind: str + :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: + :vartype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :ivar sku: + :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :ivar plan: + :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan """ _validation = { @@ -244,6 +390,29 @@ def __init__( plan: Optional["ResourceModelWithAllowedPropertySetPlan"] = None, **kwargs ): + """ + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword managed_by: The fully qualified resource ID of the resource that manages this + resource. Indicates if this resource is managed by another Azure resource. If this is present, + complete mode deployment will not delete the resource if it is removed from the template since + it is managed by another resource. + :paramtype managed_by: str + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :paramtype kind: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: + :paramtype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :keyword sku: + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :keyword plan: + :paramtype plan: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + """ super(ResourceModelWithAllowedPropertySet, self).__init__(**kwargs) self.id = None self.name = None @@ -273,50 +442,50 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + :vartype managed_by: str + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - :type kind: str + :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: + :vartype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :ivar sku: + :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :ivar plan: + :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of ApplicationGroup. (internal use). :vartype object_id: str - :param description: Description of ApplicationGroup. - :type description: str - :param friendly_name: Friendly name of ApplicationGroup. - :type friendly_name: str - :param host_pool_arm_path: Required. HostPool arm path of ApplicationGroup. - :type host_pool_arm_path: str + :ivar description: Description of ApplicationGroup. + :vartype description: str + :ivar friendly_name: Friendly name of ApplicationGroup. + :vartype friendly_name: str + :ivar host_pool_arm_path: Required. HostPool arm path of ApplicationGroup. + :vartype host_pool_arm_path: str :ivar workspace_arm_path: Workspace arm path of ApplicationGroup. :vartype workspace_arm_path: str - :param application_group_type: Required. Resource Type of ApplicationGroup. Possible values + :ivar application_group_type: Required. Resource Type of ApplicationGroup. Possible values include: "RemoteApp", "Desktop". - :type application_group_type: str or - ~desktop_virtualization_api_client.models.ApplicationGroupType - :param migration_request: The registration info of HostPool. - :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties + :vartype application_group_type: str or + ~azure.mgmt.desktopvirtualization.models.ApplicationGroupType + :ivar migration_request: The registration info of HostPool. + :vartype migration_request: ~azure.mgmt.desktopvirtualization.models.MigrationRequestProperties :ivar cloud_pc_resource: Is cloud pc resource. :vartype cloud_pc_resource: bool """ @@ -375,6 +544,42 @@ def __init__( migration_request: Optional["MigrationRequestProperties"] = None, **kwargs ): + """ + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword managed_by: The fully qualified resource ID of the resource that manages this + resource. Indicates if this resource is managed by another Azure resource. If this is present, + complete mode deployment will not delete the resource if it is removed from the template since + it is managed by another resource. + :paramtype managed_by: str + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :paramtype kind: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: + :paramtype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :keyword sku: + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :keyword plan: + :paramtype plan: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword description: Description of ApplicationGroup. + :paramtype description: str + :keyword friendly_name: Friendly name of ApplicationGroup. + :paramtype friendly_name: str + :keyword host_pool_arm_path: Required. HostPool arm path of ApplicationGroup. + :paramtype host_pool_arm_path: str + :keyword application_group_type: Required. Resource Type of ApplicationGroup. Possible values + include: "RemoteApp", "Desktop". + :paramtype application_group_type: str or + ~azure.mgmt.desktopvirtualization.models.ApplicationGroupType + :keyword migration_request: The registration info of HostPool. + :paramtype migration_request: + ~azure.mgmt.desktopvirtualization.models.MigrationRequestProperties + """ super(ApplicationGroup, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) self.system_data = None self.object_id = None @@ -392,8 +597,8 @@ class ApplicationGroupList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of ApplicationGroup definitions. - :type value: list[~desktop_virtualization_api_client.models.ApplicationGroup] + :ivar value: List of ApplicationGroup definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -413,6 +618,10 @@ def __init__( value: Optional[List["ApplicationGroup"]] = None, **kwargs ): + """ + :keyword value: List of ApplicationGroup definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ApplicationGroup] + """ super(ApplicationGroupList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -431,12 +640,12 @@ class ApplicationGroupPatch(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of ApplicationGroup. - :type description: str - :param friendly_name: Friendly name of ApplicationGroup. - :type friendly_name: str + :ivar tags: A set of tags. tags to be updated. + :vartype tags: dict[str, str] + :ivar description: Description of ApplicationGroup. + :vartype description: str + :ivar friendly_name: Friendly name of ApplicationGroup. + :vartype friendly_name: str """ _validation = { @@ -462,6 +671,14 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. tags to be updated. + :paramtype tags: dict[str, str] + :keyword description: Description of ApplicationGroup. + :paramtype description: str + :keyword friendly_name: Friendly name of ApplicationGroup. + :paramtype friendly_name: str + """ super(ApplicationGroupPatch, self).__init__(**kwargs) self.tags = tags self.description = description @@ -473,8 +690,8 @@ class ApplicationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of Application definitions. - :type value: list[~desktop_virtualization_api_client.models.Application] + :ivar value: List of Application definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.Application] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -494,6 +711,10 @@ def __init__( value: Optional[List["Application"]] = None, **kwargs ): + """ + :keyword value: List of Application definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.Application] + """ super(ApplicationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -502,35 +723,37 @@ def __init__( class ApplicationPatch(msrest.serialization.Model): """Application properties that can be patched. - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of Application. - :type description: str - :param friendly_name: Friendly name of Application. - :type friendly_name: str - :param file_path: Specifies a path for the executable file for the application. - :type file_path: str - :param command_line_setting: Specifies whether this published application can be launched with + :ivar tags: A set of tags. tags to be updated. + :vartype tags: dict[str, str] + :ivar description: Description of Application. + :vartype description: str + :ivar friendly_name: Friendly name of Application. + :vartype friendly_name: str + :ivar file_path: Specifies a path for the executable file for the application. + :vartype file_path: str + :ivar command_line_setting: Specifies whether this published application can be launched with command line arguments provided by the client, command line arguments specified at publish time, or no command line arguments at all. Possible values include: "DoNotAllow", "Allow", "Require". - :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting - :param command_line_arguments: Command Line Arguments for Application. - :type command_line_arguments: str - :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + :vartype command_line_setting: str or + ~azure.mgmt.desktopvirtualization.models.CommandLineSetting + :ivar command_line_arguments: Command Line Arguments for Application. + :vartype command_line_arguments: str + :ivar show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access server. - :type show_in_portal: bool - :param icon_path: Path to icon. - :type icon_path: str - :param icon_index: Index of the icon. - :type icon_index: int - :param msix_package_family_name: Specifies the package family name for MSIX applications. - :type msix_package_family_name: str - :param msix_package_application_id: Specifies the package application Id for MSIX applications. - :type msix_package_application_id: str - :param application_type: Resource Type of Application. Possible values include: "InBuilt", + :vartype show_in_portal: bool + :ivar icon_path: Path to icon. + :vartype icon_path: str + :ivar icon_index: Index of the icon. + :vartype icon_index: int + :ivar msix_package_family_name: Specifies the package family name for MSIX applications. + :vartype msix_package_family_name: str + :ivar msix_package_application_id: Specifies the package application Id for MSIX applications. + :vartype msix_package_application_id: str + :ivar application_type: Resource Type of Application. Possible values include: "InBuilt", "MsixApplication". - :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType + :vartype application_type: str or + ~azure.mgmt.desktopvirtualization.models.RemoteApplicationType """ _attribute_map = { @@ -565,6 +788,40 @@ def __init__( application_type: Optional[Union[str, "RemoteApplicationType"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. tags to be updated. + :paramtype tags: dict[str, str] + :keyword description: Description of Application. + :paramtype description: str + :keyword friendly_name: Friendly name of Application. + :paramtype friendly_name: str + :keyword file_path: Specifies a path for the executable file for the application. + :paramtype file_path: str + :keyword command_line_setting: Specifies whether this published application can be launched + with command line arguments provided by the client, command line arguments specified at publish + time, or no command line arguments at all. Possible values include: "DoNotAllow", "Allow", + "Require". + :paramtype command_line_setting: str or + ~azure.mgmt.desktopvirtualization.models.CommandLineSetting + :keyword command_line_arguments: Command Line Arguments for Application. + :paramtype command_line_arguments: str + :keyword show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + server. + :paramtype show_in_portal: bool + :keyword icon_path: Path to icon. + :paramtype icon_path: str + :keyword icon_index: Index of the icon. + :paramtype icon_index: int + :keyword msix_package_family_name: Specifies the package family name for MSIX applications. + :paramtype msix_package_family_name: str + :keyword msix_package_application_id: Specifies the package application Id for MSIX + applications. + :paramtype msix_package_application_id: str + :keyword application_type: Resource Type of Application. Possible values include: "InBuilt", + "MsixApplication". + :paramtype application_type: str or + ~azure.mgmt.desktopvirtualization.models.RemoteApplicationType + """ super(ApplicationPatch, self).__init__(**kwargs) self.tags = tags self.description = description @@ -583,10 +840,10 @@ def __init__( class CloudErrorProperties(msrest.serialization.Model): """Cloud error object properties. - :param code: Error code. - :type code: str - :param message: Error message indicating why the operation failed. - :type message: str + :ivar code: Error code. + :vartype code: str + :ivar message: Error message indicating why the operation failed. + :vartype message: str """ _attribute_map = { @@ -601,6 +858,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: Error code. + :paramtype code: str + :keyword message: Error message indicating why the operation failed. + :paramtype message: str + """ super(CloudErrorProperties, self).__init__(**kwargs) self.code = code self.message = message @@ -620,13 +883,13 @@ class Desktop(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Desktop. (internal use). :vartype object_id: str - :param description: Description of Desktop. - :type description: str - :param friendly_name: Friendly name of Desktop. - :type friendly_name: str + :ivar description: Description of Desktop. + :vartype description: str + :ivar friendly_name: Friendly name of Desktop. + :vartype friendly_name: str :ivar icon_hash: Hash of the icon. :vartype icon_hash: str :ivar icon_content: The icon a 64 bit string as a byte array. @@ -662,6 +925,12 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword description: Description of Desktop. + :paramtype description: str + :keyword friendly_name: Friendly name of Desktop. + :paramtype friendly_name: str + """ super(Desktop, self).__init__(**kwargs) self.system_data = None self.object_id = None @@ -676,8 +945,8 @@ class DesktopList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of Desktop definitions. - :type value: list[~desktop_virtualization_api_client.models.Desktop] + :ivar value: List of Desktop definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.Desktop] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -697,6 +966,10 @@ def __init__( value: Optional[List["Desktop"]] = None, **kwargs ): + """ + :keyword value: List of Desktop definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.Desktop] + """ super(DesktopList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -705,12 +978,12 @@ def __init__( class DesktopPatch(msrest.serialization.Model): """Desktop properties that can be patched. - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of Desktop. - :type description: str - :param friendly_name: Friendly name of Desktop. - :type friendly_name: str + :ivar tags: A set of tags. tags to be updated. + :vartype tags: dict[str, str] + :ivar description: Description of Desktop. + :vartype description: str + :ivar friendly_name: Friendly name of Desktop. + :vartype friendly_name: str """ _attribute_map = { @@ -727,6 +1000,14 @@ def __init__( friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword tags: A set of tags. tags to be updated. + :paramtype tags: dict[str, str] + :keyword description: Description of Desktop. + :paramtype description: str + :keyword friendly_name: Friendly name of Desktop. + :paramtype friendly_name: str + """ super(DesktopPatch, self).__init__(**kwargs) self.tags = tags self.description = description @@ -746,35 +1027,35 @@ class ExpandMsixImage(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param package_alias: Alias of MSIX Package. - :type package_alias: str - :param image_path: VHD/CIM image path on Network Share. - :type image_path: str - :param package_name: Package Name from appxmanifest.xml. - :type package_name: str - :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name - and Publisher name. - :type package_family_name: str - :param package_full_name: Package Full Name from appxmanifest.xml. - :type package_full_name: str - :param display_name: User friendly Name to be displayed in the portal. - :type display_name: str - :param package_relative_path: Relative Path to the package inside the image. - :type package_relative_path: str - :param is_regular_registration: Specifies how to register Package in feed. - :type is_regular_registration: bool - :param is_active: Make this version of the package the active one across the hostpool. - :type is_active: bool - :param package_dependencies: List of package dependencies. - :type package_dependencies: - list[~desktop_virtualization_api_client.models.MsixPackageDependencies] - :param version: Package Version found in the appxmanifest.xml. - :type version: str - :param last_updated: Date Package was last updated, found in the appxmanifest.xml. - :type last_updated: ~datetime.datetime - :param package_applications: List of package applications. - :type package_applications: - list[~desktop_virtualization_api_client.models.MsixPackageApplications] + :ivar package_alias: Alias of MSIX Package. + :vartype package_alias: str + :ivar image_path: VHD/CIM image path on Network Share. + :vartype image_path: str + :ivar package_name: Package Name from appxmanifest.xml. + :vartype package_name: str + :ivar package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name and + Publisher name. + :vartype package_family_name: str + :ivar package_full_name: Package Full Name from appxmanifest.xml. + :vartype package_full_name: str + :ivar display_name: User friendly Name to be displayed in the portal. + :vartype display_name: str + :ivar package_relative_path: Relative Path to the package inside the image. + :vartype package_relative_path: str + :ivar is_regular_registration: Specifies how to register Package in feed. + :vartype is_regular_registration: bool + :ivar is_active: Make this version of the package the active one across the hostpool. + :vartype is_active: bool + :ivar package_dependencies: List of package dependencies. + :vartype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :ivar version: Package Version found in the appxmanifest.xml. + :vartype version: str + :ivar last_updated: Date Package was last updated, found in the appxmanifest.xml. + :vartype last_updated: ~datetime.datetime + :ivar package_applications: List of package applications. + :vartype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] """ _validation = { @@ -820,6 +1101,37 @@ def __init__( package_applications: Optional[List["MsixPackageApplications"]] = None, **kwargs ): + """ + :keyword package_alias: Alias of MSIX Package. + :paramtype package_alias: str + :keyword image_path: VHD/CIM image path on Network Share. + :paramtype image_path: str + :keyword package_name: Package Name from appxmanifest.xml. + :paramtype package_name: str + :keyword package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :paramtype package_family_name: str + :keyword package_full_name: Package Full Name from appxmanifest.xml. + :paramtype package_full_name: str + :keyword display_name: User friendly Name to be displayed in the portal. + :paramtype display_name: str + :keyword package_relative_path: Relative Path to the package inside the image. + :paramtype package_relative_path: str + :keyword is_regular_registration: Specifies how to register Package in feed. + :paramtype is_regular_registration: bool + :keyword is_active: Make this version of the package the active one across the hostpool. + :paramtype is_active: bool + :keyword package_dependencies: List of package dependencies. + :paramtype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :keyword version: Package Version found in the appxmanifest.xml. + :paramtype version: str + :keyword last_updated: Date Package was last updated, found in the appxmanifest.xml. + :paramtype last_updated: ~datetime.datetime + :keyword package_applications: List of package applications. + :paramtype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + """ super(ExpandMsixImage, self).__init__(**kwargs) self.package_alias = package_alias self.image_path = image_path @@ -841,8 +1153,8 @@ class ExpandMsixImageList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of MSIX package properties from give MSIX Image. - :type value: list[~desktop_virtualization_api_client.models.ExpandMsixImage] + :ivar value: List of MSIX package properties from give MSIX Image. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -862,6 +1174,10 @@ def __init__( value: Optional[List["ExpandMsixImage"]] = None, **kwargs ): + """ + :keyword value: List of MSIX package properties from give MSIX Image. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ExpandMsixImage] + """ super(ExpandMsixImageList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -882,91 +1198,98 @@ class HostPool(ResourceModelWithAllowedPropertySet): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + :vartype managed_by: str + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - :type kind: str + :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: + :vartype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :ivar sku: + :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :ivar plan: + :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of HostPool. (internal use). :vartype object_id: str - :param friendly_name: Friendly name of HostPool. - :type friendly_name: str - :param description: Description of HostPool. - :type description: str - :param host_pool_type: Required. HostPool type for desktop. Possible values include: - "Personal", "Pooled", "BYODesktop". - :type host_pool_type: str or ~desktop_virtualization_api_client.models.HostPoolType - :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible + :ivar friendly_name: Friendly name of HostPool. + :vartype friendly_name: str + :ivar description: Description of HostPool. + :vartype description: str + :ivar host_pool_type: Required. HostPool type for desktop. Possible values include: "Personal", + "Pooled", "BYODesktop". + :vartype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.HostPoolType + :ivar personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible values include: "Automatic", "Direct". - :type personal_desktop_assignment_type: str or - ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType - :param custom_rdp_property: Custom rdp property of HostPool. - :type custom_rdp_property: str - :param max_session_limit: The max session limit of HostPool. - :type max_session_limit: int - :param load_balancer_type: Required. The type of the load balancer. Possible values include: + :vartype personal_desktop_assignment_type: str or + ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :ivar custom_rdp_property: Custom rdp property of HostPool. + :vartype custom_rdp_property: str + :ivar max_session_limit: The max session limit of HostPool. + :vartype max_session_limit: int + :ivar load_balancer_type: Required. The type of the load balancer. Possible values include: "BreadthFirst", "DepthFirst", "Persistent". - :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType - :param ring: The ring number of HostPool. - :type ring: int - :param validation_environment: Is validation environment. - :type validation_environment: bool - :param registration_info: The registration info of HostPool. - :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfo - :param vm_template: VM template for sessionhosts configuration within hostpool. - :type vm_template: str + :vartype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType + :ivar ring: The ring number of HostPool. + :vartype ring: int + :ivar validation_environment: Is validation environment. + :vartype validation_environment: bool + :ivar registration_info: The registration info of HostPool. + :vartype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo + :ivar vm_template: VM template for sessionhosts configuration within hostpool. + :vartype vm_template: str :ivar application_group_references: List of applicationGroup links. :vartype application_group_references: list[str] - :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. - :type ssoadfs_authority: str - :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + :ivar ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :vartype ssoadfs_authority: str + :ivar sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO certificates. - :type sso_client_id: str - :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + :vartype sso_client_id: str + :ivar sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for communication to ADFS. - :type sso_client_secret_key_vault_path: str - :param sso_secret_type: The type of single sign on Secret Type. Possible values include: + :vartype sso_client_secret_key_vault_path: str + :ivar sso_secret_type: The type of single sign on Secret Type. Possible values include: "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". - :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType - :param preferred_app_group_type: Required. The type of preferred application group type, - default to Desktop Application Group. Possible values include: "None", "Desktop", - "RailApplications". - :type preferred_app_group_type: str or - ~desktop_virtualization_api_client.models.PreferredAppGroupType - :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. - :type start_vm_on_connect: bool - :param migration_request: The registration info of HostPool. - :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties + :vartype sso_secret_type: str or ~azure.mgmt.desktopvirtualization.models.SSOSecretType + :ivar preferred_app_group_type: Required. The type of preferred application group type, default + to Desktop Application Group. Possible values include: "None", "Desktop", "RailApplications". + :vartype preferred_app_group_type: str or + ~azure.mgmt.desktopvirtualization.models.PreferredAppGroupType + :ivar start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :vartype start_vm_on_connect: bool + :ivar migration_request: The registration info of HostPool. + :vartype migration_request: ~azure.mgmt.desktopvirtualization.models.MigrationRequestProperties :ivar cloud_pc_resource: Is cloud pc resource. :vartype cloud_pc_resource: bool - :param public_network_access: Enabled allows this resource to be accessed from both public and + :ivar public_network_access: Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. - Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess + Possible values include: "Enabled", "Disabled", "EnabledForSessionHostsOnly", + "EnabledForClientsOnly". + :vartype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.HostpoolPublicNetworkAccess + :ivar agent_update: The session host configuration for updating agent, monitoring agent, and + stack component. + :vartype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdateProperties + :ivar private_endpoint_connections: List of private endpoint connection associated with the + specified resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection] """ _validation = { @@ -982,6 +1305,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): 'application_group_references': {'readonly': True}, 'preferred_app_group_type': {'required': True}, 'cloud_pc_resource': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -1019,6 +1343,8 @@ class HostPool(ResourceModelWithAllowedPropertySet): 'migration_request': {'key': 'properties.migrationRequest', 'type': 'MigrationRequestProperties'}, 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'agent_update': {'key': 'properties.agentUpdate', 'type': 'AgentUpdateProperties'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, } def __init__( @@ -1049,9 +1375,89 @@ def __init__( sso_secret_type: Optional[Union[str, "SSOSecretType"]] = None, start_vm_on_connect: Optional[bool] = None, migration_request: Optional["MigrationRequestProperties"] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + public_network_access: Optional[Union[str, "HostpoolPublicNetworkAccess"]] = None, + agent_update: Optional["AgentUpdateProperties"] = None, **kwargs ): + """ + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword managed_by: The fully qualified resource ID of the resource that manages this + resource. Indicates if this resource is managed by another Azure resource. If this is present, + complete mode deployment will not delete the resource if it is removed from the template since + it is managed by another resource. + :paramtype managed_by: str + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :paramtype kind: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: + :paramtype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :keyword sku: + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :keyword plan: + :paramtype plan: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword friendly_name: Friendly name of HostPool. + :paramtype friendly_name: str + :keyword description: Description of HostPool. + :paramtype description: str + :keyword host_pool_type: Required. HostPool type for desktop. Possible values include: + "Personal", "Pooled", "BYODesktop". + :paramtype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.HostPoolType + :keyword personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. + Possible values include: "Automatic", "Direct". + :paramtype personal_desktop_assignment_type: str or + ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :keyword custom_rdp_property: Custom rdp property of HostPool. + :paramtype custom_rdp_property: str + :keyword max_session_limit: The max session limit of HostPool. + :paramtype max_session_limit: int + :keyword load_balancer_type: Required. The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :paramtype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType + :keyword ring: The ring number of HostPool. + :paramtype ring: int + :keyword validation_environment: Is validation environment. + :paramtype validation_environment: bool + :keyword registration_info: The registration info of HostPool. + :paramtype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo + :keyword vm_template: VM template for sessionhosts configuration within hostpool. + :paramtype vm_template: str + :keyword ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :paramtype ssoadfs_authority: str + :keyword sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + certificates. + :paramtype sso_client_id: str + :keyword sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + communication to ADFS. + :paramtype sso_client_secret_key_vault_path: str + :keyword sso_secret_type: The type of single sign on Secret Type. Possible values include: + "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". + :paramtype sso_secret_type: str or ~azure.mgmt.desktopvirtualization.models.SSOSecretType + :keyword preferred_app_group_type: Required. The type of preferred application group type, + default to Desktop Application Group. Possible values include: "None", "Desktop", + "RailApplications". + :paramtype preferred_app_group_type: str or + ~azure.mgmt.desktopvirtualization.models.PreferredAppGroupType + :keyword start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :paramtype start_vm_on_connect: bool + :keyword migration_request: The registration info of HostPool. + :paramtype migration_request: + ~azure.mgmt.desktopvirtualization.models.MigrationRequestProperties + :keyword public_network_access: Enabled allows this resource to be accessed from both public + and private networks, Disabled allows this resource to only be accessed via private endpoints. + Possible values include: "Enabled", "Disabled", "EnabledForSessionHostsOnly", + "EnabledForClientsOnly". + :paramtype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.HostpoolPublicNetworkAccess + :keyword agent_update: The session host configuration for updating agent, monitoring agent, and + stack component. + :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdateProperties + """ super(HostPool, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) self.system_data = None self.object_id = None @@ -1076,6 +1482,8 @@ def __init__( self.migration_request = migration_request self.cloud_pc_resource = None self.public_network_access = public_network_access + self.agent_update = agent_update + self.private_endpoint_connections = None class HostPoolList(msrest.serialization.Model): @@ -1083,8 +1491,8 @@ class HostPoolList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of HostPool definitions. - :type value: list[~desktop_virtualization_api_client.models.HostPool] + :ivar value: List of HostPool definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.HostPool] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -1104,6 +1512,10 @@ def __init__( value: Optional[List["HostPool"]] = None, **kwargs ): + """ + :keyword value: List of HostPool definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.HostPool] + """ super(HostPoolList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1122,52 +1534,56 @@ class HostPoolPatch(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param friendly_name: Friendly name of HostPool. - :type friendly_name: str - :param description: Description of HostPool. - :type description: str - :param custom_rdp_property: Custom rdp property of HostPool. - :type custom_rdp_property: str - :param max_session_limit: The max session limit of HostPool. - :type max_session_limit: int - :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible + :ivar tags: A set of tags. tags to be updated. + :vartype tags: dict[str, str] + :ivar friendly_name: Friendly name of HostPool. + :vartype friendly_name: str + :ivar description: Description of HostPool. + :vartype description: str + :ivar custom_rdp_property: Custom rdp property of HostPool. + :vartype custom_rdp_property: str + :ivar max_session_limit: The max session limit of HostPool. + :vartype max_session_limit: int + :ivar personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible values include: "Automatic", "Direct". - :type personal_desktop_assignment_type: str or - ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType - :param load_balancer_type: The type of the load balancer. Possible values include: + :vartype personal_desktop_assignment_type: str or + ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :ivar load_balancer_type: The type of the load balancer. Possible values include: "BreadthFirst", "DepthFirst", "Persistent". - :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType - :param ring: The ring number of HostPool. - :type ring: int - :param validation_environment: Is validation environment. - :type validation_environment: bool - :param registration_info: The registration info of HostPool. - :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfoPatch - :param vm_template: VM template for sessionhosts configuration within hostpool. - :type vm_template: str - :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. - :type ssoadfs_authority: str - :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + :vartype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType + :ivar ring: The ring number of HostPool. + :vartype ring: int + :ivar validation_environment: Is validation environment. + :vartype validation_environment: bool + :ivar registration_info: The registration info of HostPool. + :vartype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch + :ivar vm_template: VM template for sessionhosts configuration within hostpool. + :vartype vm_template: str + :ivar ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :vartype ssoadfs_authority: str + :ivar sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO certificates. - :type sso_client_id: str - :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + :vartype sso_client_id: str + :ivar sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for communication to ADFS. - :type sso_client_secret_key_vault_path: str - :param sso_secret_type: The type of single sign on Secret Type. Possible values include: + :vartype sso_client_secret_key_vault_path: str + :ivar sso_secret_type: The type of single sign on Secret Type. Possible values include: "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". - :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType - :param preferred_app_group_type: The type of preferred application group type, default to + :vartype sso_secret_type: str or ~azure.mgmt.desktopvirtualization.models.SSOSecretType + :ivar preferred_app_group_type: The type of preferred application group type, default to Desktop Application Group. Possible values include: "None", "Desktop", "RailApplications". - :type preferred_app_group_type: str or - ~desktop_virtualization_api_client.models.PreferredAppGroupType - :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. - :type start_vm_on_connect: bool - :param public_network_access: Enabled to allow this resource to be access from the public - network. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess + :vartype preferred_app_group_type: str or + ~azure.mgmt.desktopvirtualization.models.PreferredAppGroupType + :ivar start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :vartype start_vm_on_connect: bool + :ivar public_network_access: Enabled to allow this resource to be access from the public + network. Possible values include: "Enabled", "Disabled", "EnabledForSessionHostsOnly", + "EnabledForClientsOnly". + :vartype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.HostpoolPublicNetworkAccess + :ivar agent_update: The session host configuration for updating agent, monitoring agent, and + stack component. + :vartype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties """ _validation = { @@ -1198,6 +1614,7 @@ class HostPoolPatch(Resource): 'preferred_app_group_type': {'key': 'properties.preferredAppGroupType', 'type': 'str'}, 'start_vm_on_connect': {'key': 'properties.startVMOnConnect', 'type': 'bool'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'agent_update': {'key': 'properties.agentUpdate', 'type': 'AgentUpdatePatchProperties'}, } def __init__( @@ -1220,9 +1637,62 @@ def __init__( sso_secret_type: Optional[Union[str, "SSOSecretType"]] = None, preferred_app_group_type: Optional[Union[str, "PreferredAppGroupType"]] = None, start_vm_on_connect: Optional[bool] = None, - public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + public_network_access: Optional[Union[str, "HostpoolPublicNetworkAccess"]] = None, + agent_update: Optional["AgentUpdatePatchProperties"] = None, **kwargs ): + """ + :keyword tags: A set of tags. tags to be updated. + :paramtype tags: dict[str, str] + :keyword friendly_name: Friendly name of HostPool. + :paramtype friendly_name: str + :keyword description: Description of HostPool. + :paramtype description: str + :keyword custom_rdp_property: Custom rdp property of HostPool. + :paramtype custom_rdp_property: str + :keyword max_session_limit: The max session limit of HostPool. + :paramtype max_session_limit: int + :keyword personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. + Possible values include: "Automatic", "Direct". + :paramtype personal_desktop_assignment_type: str or + ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :keyword load_balancer_type: The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :paramtype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType + :keyword ring: The ring number of HostPool. + :paramtype ring: int + :keyword validation_environment: Is validation environment. + :paramtype validation_environment: bool + :keyword registration_info: The registration info of HostPool. + :paramtype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch + :keyword vm_template: VM template for sessionhosts configuration within hostpool. + :paramtype vm_template: str + :keyword ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :paramtype ssoadfs_authority: str + :keyword sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + certificates. + :paramtype sso_client_id: str + :keyword sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + communication to ADFS. + :paramtype sso_client_secret_key_vault_path: str + :keyword sso_secret_type: The type of single sign on Secret Type. Possible values include: + "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". + :paramtype sso_secret_type: str or ~azure.mgmt.desktopvirtualization.models.SSOSecretType + :keyword preferred_app_group_type: The type of preferred application group type, default to + Desktop Application Group. Possible values include: "None", "Desktop", "RailApplications". + :paramtype preferred_app_group_type: str or + ~azure.mgmt.desktopvirtualization.models.PreferredAppGroupType + :keyword start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :paramtype start_vm_on_connect: bool + :keyword public_network_access: Enabled to allow this resource to be access from the public + network. Possible values include: "Enabled", "Disabled", "EnabledForSessionHostsOnly", + "EnabledForClientsOnly". + :paramtype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.HostpoolPublicNetworkAccess + :keyword agent_update: The session host configuration for updating agent, monitoring agent, and + stack component. + :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + """ super(HostPoolPatch, self).__init__(**kwargs) self.tags = tags self.friendly_name = friendly_name @@ -1242,6 +1712,7 @@ def __init__( self.preferred_app_group_type = preferred_app_group_type self.start_vm_on_connect = start_vm_on_connect self.public_network_access = public_network_access + self.agent_update = agent_update class Identity(msrest.serialization.Model): @@ -1253,9 +1724,9 @@ class Identity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -1275,6 +1746,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(Identity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1284,12 +1760,12 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Specifications of the Log for Azure Monitoring. - :param name: Name of the log. - :type name: str - :param display_name: Localized friendly display name of the log. - :type display_name: str - :param blob_duration: Blob duration of the log. - :type blob_duration: str + :ivar name: Name of the log. + :vartype name: str + :ivar display_name: Localized friendly display name of the log. + :vartype display_name: str + :ivar blob_duration: Blob duration of the log. + :vartype blob_duration: str """ _attribute_map = { @@ -1306,20 +1782,96 @@ def __init__( blob_duration: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of the log. + :paramtype name: str + :keyword display_name: Localized friendly display name of the log. + :paramtype display_name: str + :keyword blob_duration: Blob duration of the log. + :paramtype blob_duration: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name self.blob_duration = blob_duration +class MaintenanceWindowPatchProperties(msrest.serialization.Model): + """Maintenance window starting hour and day of week. + + :ivar hour: The update start hour of the day. (0 - 23). + :vartype hour: int + :ivar day_of_week: Day of the week. Possible values include: "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", "Sunday". + :vartype day_of_week: str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek + """ + + _attribute_map = { + 'hour': {'key': 'hour', 'type': 'int'}, + 'day_of_week': {'key': 'dayOfWeek', 'type': 'str'}, + } + + def __init__( + self, + *, + hour: Optional[int] = None, + day_of_week: Optional[Union[str, "DayOfWeek"]] = None, + **kwargs + ): + """ + :keyword hour: The update start hour of the day. (0 - 23). + :paramtype hour: int + :keyword day_of_week: Day of the week. Possible values include: "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". + :paramtype day_of_week: str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek + """ + super(MaintenanceWindowPatchProperties, self).__init__(**kwargs) + self.hour = hour + self.day_of_week = day_of_week + + +class MaintenanceWindowProperties(msrest.serialization.Model): + """Maintenance window starting hour and day of week. + + :ivar hour: The update start hour of the day. (0 - 23). + :vartype hour: int + :ivar day_of_week: Day of the week. Possible values include: "Monday", "Tuesday", "Wednesday", + "Thursday", "Friday", "Saturday", "Sunday". + :vartype day_of_week: str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek + """ + + _attribute_map = { + 'hour': {'key': 'hour', 'type': 'int'}, + 'day_of_week': {'key': 'dayOfWeek', 'type': 'str'}, + } + + def __init__( + self, + *, + hour: Optional[int] = None, + day_of_week: Optional[Union[str, "DayOfWeek"]] = None, + **kwargs + ): + """ + :keyword hour: The update start hour of the day. (0 - 23). + :paramtype hour: int + :keyword day_of_week: Day of the week. Possible values include: "Monday", "Tuesday", + "Wednesday", "Thursday", "Friday", "Saturday", "Sunday". + :paramtype day_of_week: str or ~azure.mgmt.desktopvirtualization.models.DayOfWeek + """ + super(MaintenanceWindowProperties, self).__init__(**kwargs) + self.hour = hour + self.day_of_week = day_of_week + + class MigrationRequestProperties(msrest.serialization.Model): """Properties for arm migration. - :param operation: The type of operation for migration. Possible values include: "Start", + :ivar operation: The type of operation for migration. Possible values include: "Start", "Revoke", "Complete", "Hide", "Unhide". - :type operation: str or ~desktop_virtualization_api_client.models.Operation - :param migration_path: The path to the legacy object to migrate. - :type migration_path: str + :vartype operation: str or ~azure.mgmt.desktopvirtualization.models.Operation + :ivar migration_path: The path to the legacy object to migrate. + :vartype migration_path: str """ _attribute_map = { @@ -1334,6 +1886,13 @@ def __init__( migration_path: Optional[str] = None, **kwargs ): + """ + :keyword operation: The type of operation for migration. Possible values include: "Start", + "Revoke", "Complete", "Hide", "Unhide". + :paramtype operation: str or ~azure.mgmt.desktopvirtualization.models.Operation + :keyword migration_path: The path to the legacy object to migrate. + :paramtype migration_path: str + """ super(MigrationRequestProperties, self).__init__(**kwargs) self.operation = operation self.migration_path = migration_path @@ -1342,8 +1901,8 @@ def __init__( class MSIXImageURI(msrest.serialization.Model): """Represents URI referring to MSIX Image. - :param uri: URI to Image. - :type uri: str + :ivar uri: URI to Image. + :vartype uri: str """ _attribute_map = { @@ -1356,6 +1915,10 @@ def __init__( uri: Optional[str] = None, **kwargs ): + """ + :keyword uri: URI to Image. + :paramtype uri: str + """ super(MSIXImageURI, self).__init__(**kwargs) self.uri = uri @@ -1374,32 +1937,32 @@ class MSIXPackage(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData - :param image_path: VHD/CIM image path on Network Share. - :type image_path: str - :param package_name: Package Name from appxmanifest.xml. - :type package_name: str - :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name - and Publisher name. - :type package_family_name: str - :param display_name: User friendly Name to be displayed in the portal. - :type display_name: str - :param package_relative_path: Relative Path to the package inside the image. - :type package_relative_path: str - :param is_regular_registration: Specifies how to register Package in feed. - :type is_regular_registration: bool - :param is_active: Make this version of the package the active one across the hostpool. - :type is_active: bool - :param package_dependencies: List of package dependencies. - :type package_dependencies: - list[~desktop_virtualization_api_client.models.MsixPackageDependencies] - :param version: Package Version found in the appxmanifest.xml. - :type version: str - :param last_updated: Date Package was last updated, found in the appxmanifest.xml. - :type last_updated: ~datetime.datetime - :param package_applications: List of package applications. - :type package_applications: - list[~desktop_virtualization_api_client.models.MsixPackageApplications] + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar image_path: VHD/CIM image path on Network Share. + :vartype image_path: str + :ivar package_name: Package Name from appxmanifest.xml. + :vartype package_name: str + :ivar package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name and + Publisher name. + :vartype package_family_name: str + :ivar display_name: User friendly Name to be displayed in the portal. + :vartype display_name: str + :ivar package_relative_path: Relative Path to the package inside the image. + :vartype package_relative_path: str + :ivar is_regular_registration: Specifies how to register Package in feed. + :vartype is_regular_registration: bool + :ivar is_active: Make this version of the package the active one across the hostpool. + :vartype is_active: bool + :ivar package_dependencies: List of package dependencies. + :vartype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :ivar version: Package Version found in the appxmanifest.xml. + :vartype version: str + :ivar last_updated: Date Package was last updated, found in the appxmanifest.xml. + :vartype last_updated: ~datetime.datetime + :ivar package_applications: List of package applications. + :vartype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] """ _validation = { @@ -1443,6 +2006,33 @@ def __init__( package_applications: Optional[List["MsixPackageApplications"]] = None, **kwargs ): + """ + :keyword image_path: VHD/CIM image path on Network Share. + :paramtype image_path: str + :keyword package_name: Package Name from appxmanifest.xml. + :paramtype package_name: str + :keyword package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :paramtype package_family_name: str + :keyword display_name: User friendly Name to be displayed in the portal. + :paramtype display_name: str + :keyword package_relative_path: Relative Path to the package inside the image. + :paramtype package_relative_path: str + :keyword is_regular_registration: Specifies how to register Package in feed. + :paramtype is_regular_registration: bool + :keyword is_active: Make this version of the package the active one across the hostpool. + :paramtype is_active: bool + :keyword package_dependencies: List of package dependencies. + :paramtype package_dependencies: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageDependencies] + :keyword version: Package Version found in the appxmanifest.xml. + :paramtype version: str + :keyword last_updated: Date Package was last updated, found in the appxmanifest.xml. + :paramtype last_updated: ~datetime.datetime + :keyword package_applications: List of package applications. + :paramtype package_applications: + list[~azure.mgmt.desktopvirtualization.models.MsixPackageApplications] + """ super(MSIXPackage, self).__init__(**kwargs) self.system_data = None self.image_path = image_path @@ -1461,21 +2051,21 @@ def __init__( class MsixPackageApplications(msrest.serialization.Model): """Schema for MSIX Package Application properties. - :param app_id: Package Application Id, found in appxmanifest.xml. - :type app_id: str - :param description: Description of Package Application. - :type description: str - :param app_user_model_id: Used to activate Package Application. Consists of Package Name and + :ivar app_id: Package Application Id, found in appxmanifest.xml. + :vartype app_id: str + :ivar description: Description of Package Application. + :vartype description: str + :ivar app_user_model_id: Used to activate Package Application. Consists of Package Name and ApplicationID. Found in appxmanifest.xml. - :type app_user_model_id: str - :param friendly_name: User friendly name. - :type friendly_name: str - :param icon_image_name: User friendly name. - :type icon_image_name: str - :param raw_icon: the icon a 64 bit string as a byte array. - :type raw_icon: bytearray - :param raw_png: the icon a 64 bit string as a byte array. - :type raw_png: bytearray + :vartype app_user_model_id: str + :ivar friendly_name: User friendly name. + :vartype friendly_name: str + :ivar icon_image_name: User friendly name. + :vartype icon_image_name: str + :ivar raw_icon: the icon a 64 bit string as a byte array. + :vartype raw_icon: bytearray + :ivar raw_png: the icon a 64 bit string as a byte array. + :vartype raw_png: bytearray """ _attribute_map = { @@ -1500,6 +2090,23 @@ def __init__( raw_png: Optional[bytearray] = None, **kwargs ): + """ + :keyword app_id: Package Application Id, found in appxmanifest.xml. + :paramtype app_id: str + :keyword description: Description of Package Application. + :paramtype description: str + :keyword app_user_model_id: Used to activate Package Application. Consists of Package Name and + ApplicationID. Found in appxmanifest.xml. + :paramtype app_user_model_id: str + :keyword friendly_name: User friendly name. + :paramtype friendly_name: str + :keyword icon_image_name: User friendly name. + :paramtype icon_image_name: str + :keyword raw_icon: the icon a 64 bit string as a byte array. + :paramtype raw_icon: bytearray + :keyword raw_png: the icon a 64 bit string as a byte array. + :paramtype raw_png: bytearray + """ super(MsixPackageApplications, self).__init__(**kwargs) self.app_id = app_id self.description = description @@ -1513,12 +2120,12 @@ def __init__( class MsixPackageDependencies(msrest.serialization.Model): """Schema for MSIX Package Dependencies properties. - :param dependency_name: Name of package dependency. - :type dependency_name: str - :param publisher: Name of dependency publisher. - :type publisher: str - :param min_version: Dependency version required. - :type min_version: str + :ivar dependency_name: Name of package dependency. + :vartype dependency_name: str + :ivar publisher: Name of dependency publisher. + :vartype publisher: str + :ivar min_version: Dependency version required. + :vartype min_version: str """ _attribute_map = { @@ -1535,6 +2142,14 @@ def __init__( min_version: Optional[str] = None, **kwargs ): + """ + :keyword dependency_name: Name of package dependency. + :paramtype dependency_name: str + :keyword publisher: Name of dependency publisher. + :paramtype publisher: str + :keyword min_version: Dependency version required. + :paramtype min_version: str + """ super(MsixPackageDependencies, self).__init__(**kwargs) self.dependency_name = dependency_name self.publisher = publisher @@ -1546,8 +2161,8 @@ class MSIXPackageList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of MSIX Package definitions. - :type value: list[~desktop_virtualization_api_client.models.MSIXPackage] + :ivar value: List of MSIX Package definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.MSIXPackage] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -1567,6 +2182,10 @@ def __init__( value: Optional[List["MSIXPackage"]] = None, **kwargs ): + """ + :keyword value: List of MSIX Package definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.MSIXPackage] + """ super(MSIXPackageList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1585,12 +2204,12 @@ class MSIXPackagePatch(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param is_active: Set a version of the package to be active across hostpool. - :type is_active: bool - :param is_regular_registration: Set Registration mode. Regular or Delayed. - :type is_regular_registration: bool - :param display_name: Display name for MSIX Package. - :type display_name: str + :ivar is_active: Set a version of the package to be active across hostpool. + :vartype is_active: bool + :ivar is_regular_registration: Set Registration mode. Regular or Delayed. + :vartype is_regular_registration: bool + :ivar display_name: Display name for MSIX Package. + :vartype display_name: str """ _validation = { @@ -1616,6 +2235,14 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword is_active: Set a version of the package to be active across hostpool. + :paramtype is_active: bool + :keyword is_regular_registration: Set Registration mode. Regular or Delayed. + :paramtype is_regular_registration: bool + :keyword display_name: Display name for MSIX Package. + :paramtype display_name: str + """ super(MSIXPackagePatch, self).__init__(**kwargs) self.is_active = is_active self.is_regular_registration = is_regular_registration @@ -1625,8 +2252,8 @@ def __init__( class OperationProperties(msrest.serialization.Model): """Properties of the operation. - :param service_specification: Service specification payload. - :type service_specification: ~desktop_virtualization_api_client.models.ServiceSpecification + :ivar service_specification: Service specification payload. + :vartype service_specification: ~azure.mgmt.desktopvirtualization.models.ServiceSpecification """ _attribute_map = { @@ -1639,6 +2266,10 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword service_specification: Service specification payload. + :paramtype service_specification: ~azure.mgmt.desktopvirtualization.models.ServiceSpecification + """ super(OperationProperties, self).__init__(**kwargs) self.service_specification = service_specification @@ -1648,19 +2279,19 @@ class Plan(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. - :type name: str - :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. + :ivar name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :vartype name: str + :ivar publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. - :type publisher: str - :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product + :vartype publisher: str + :ivar product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. - :type product: str - :param promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :type promotion_code: str - :param version: The version of the desired product/artifact. - :type version: str + :vartype product: str + :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the + said product/artifact. + :vartype promotion_code: str + :ivar version: The version of the desired product/artifact. + :vartype version: str """ _validation = { @@ -1687,6 +2318,21 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :paramtype name: str + :keyword publisher: Required. The publisher of the 3rd Party Artifact that is being bought. + E.g. NewRelic. + :paramtype publisher: str + :keyword product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. + Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + :paramtype product: str + :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :paramtype promotion_code: str + :keyword version: The version of the desired product/artifact. + :paramtype version: str + """ super(Plan, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -1716,6 +2362,8 @@ def __init__( self, **kwargs ): + """ + """ super(PrivateEndpoint, self).__init__(**kwargs) self.id = None @@ -1733,16 +2381,16 @@ class PrivateEndpointConnection(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState - :param provisioning_state: The provisioning state of the private endpoint connection resource. + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :type provisioning_state: str or - ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState + :vartype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState """ _validation = { @@ -1768,6 +2416,18 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: The provisioning state of the private endpoint connection + resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState + """ super(PrivateEndpointConnection, self).__init__(**kwargs) self.private_endpoint = private_endpoint self.private_link_service_connection_state = private_link_service_connection_state @@ -1779,9 +2439,9 @@ class PrivateEndpointConnectionListResultWithSystemData(msrest.serialization.Mod Variables are only populated by the server, and will be ignored when sending a request. - :param value: Array of private endpoint connections. - :type value: - list[~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData] + :ivar value: Array of private endpoint connections. + :vartype value: + list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -1801,6 +2461,11 @@ def __init__( value: Optional[List["PrivateEndpointConnectionWithSystemData"]] = None, **kwargs ): + """ + :keyword value: Array of private endpoint connections. + :paramtype value: + list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData] + """ super(PrivateEndpointConnectionListResultWithSystemData, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1819,18 +2484,18 @@ class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param private_endpoint: The resource of private end point. - :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint - :param private_link_service_connection_state: A collection of information about the state of - the connection between service consumer and provider. - :type private_link_service_connection_state: - ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState - :param provisioning_state: The provisioning state of the private endpoint connection resource. + :ivar private_endpoint: The resource of private end point. + :vartype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. + :vartype private_link_service_connection_state: + ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". - :type provisioning_state: str or - ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState + :vartype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData """ _validation = { @@ -1858,6 +2523,18 @@ def __init__( provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, **kwargs ): + """ + :keyword private_endpoint: The resource of private end point. + :paramtype private_endpoint: ~azure.mgmt.desktopvirtualization.models.PrivateEndpoint + :keyword private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :paramtype private_link_service_connection_state: + ~azure.mgmt.desktopvirtualization.models.PrivateLinkServiceConnectionState + :keyword provisioning_state: The provisioning state of the private endpoint connection + resource. Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :paramtype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionProvisioningState + """ super(PrivateEndpointConnectionWithSystemData, self).__init__(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state, provisioning_state=provisioning_state, **kwargs) self.system_data = None @@ -1879,8 +2556,8 @@ class PrivateLinkResource(Resource): :vartype group_id: str :ivar required_members: The private link resource required member names. :vartype required_members: list[str] - :param required_zone_names: The private link resource Private link DNS zone name. - :type required_zone_names: list[str] + :ivar required_zone_names: The private link resource Private link DNS zone name. + :vartype required_zone_names: list[str] """ _validation = { @@ -1906,6 +2583,10 @@ def __init__( required_zone_names: Optional[List[str]] = None, **kwargs ): + """ + :keyword required_zone_names: The private link resource Private link DNS zone name. + :paramtype required_zone_names: list[str] + """ super(PrivateLinkResource, self).__init__(**kwargs) self.group_id = None self.required_members = None @@ -1917,8 +2598,8 @@ class PrivateLinkResourceListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: Array of private link resources. - :type value: list[~desktop_virtualization_api_client.models.PrivateLinkResource] + :ivar value: Array of private link resources. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -1938,6 +2619,10 @@ def __init__( value: Optional[List["PrivateLinkResource"]] = None, **kwargs ): + """ + :keyword value: Array of private link resources. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.PrivateLinkResource] + """ super(PrivateLinkResourceListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1946,15 +2631,15 @@ def __init__( class PrivateLinkServiceConnectionState(msrest.serialization.Model): """A collection of information about the state of the connection between service consumer and provider. - :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. Possible values include: "Pending", "Approved", "Rejected". - :type status: str or - ~desktop_virtualization_api_client.models.PrivateEndpointServiceConnectionStatus - :param description: The reason for approval/rejection of the connection. - :type description: str - :param actions_required: A message indicating if changes on the service provider require any + :vartype status: str or + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any updates on the consumer. - :type actions_required: str + :vartype actions_required: str """ _attribute_map = { @@ -1971,6 +2656,17 @@ def __init__( actions_required: Optional[str] = None, **kwargs ): + """ + :keyword status: Indicates whether the connection has been Approved/Rejected/Removed by the + owner of the service. Possible values include: "Pending", "Approved", "Rejected". + :paramtype status: str or + ~azure.mgmt.desktopvirtualization.models.PrivateEndpointServiceConnectionStatus + :keyword description: The reason for approval/rejection of the connection. + :paramtype description: str + :keyword actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :paramtype actions_required: str + """ super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) self.status = status self.description = description @@ -1980,14 +2676,14 @@ def __init__( class RegistrationInfo(msrest.serialization.Model): """Represents a RegistrationInfo definition. - :param expiration_time: Expiration time of registration token. - :type expiration_time: ~datetime.datetime - :param token: The registration token base64 encoded string. - :type token: str - :param registration_token_operation: The type of resetting the token. Possible values include: + :ivar expiration_time: Expiration time of registration token. + :vartype expiration_time: ~datetime.datetime + :ivar token: The registration token base64 encoded string. + :vartype token: str + :ivar registration_token_operation: The type of resetting the token. Possible values include: "Delete", "None", "Update". - :type registration_token_operation: str or - ~desktop_virtualization_api_client.models.RegistrationTokenOperation + :vartype registration_token_operation: str or + ~azure.mgmt.desktopvirtualization.models.RegistrationTokenOperation """ _attribute_map = { @@ -2004,6 +2700,16 @@ def __init__( registration_token_operation: Optional[Union[str, "RegistrationTokenOperation"]] = None, **kwargs ): + """ + :keyword expiration_time: Expiration time of registration token. + :paramtype expiration_time: ~datetime.datetime + :keyword token: The registration token base64 encoded string. + :paramtype token: str + :keyword registration_token_operation: The type of resetting the token. Possible values + include: "Delete", "None", "Update". + :paramtype registration_token_operation: str or + ~azure.mgmt.desktopvirtualization.models.RegistrationTokenOperation + """ super(RegistrationInfo, self).__init__(**kwargs) self.expiration_time = expiration_time self.token = token @@ -2013,12 +2719,12 @@ def __init__( class RegistrationInfoPatch(msrest.serialization.Model): """Represents a RegistrationInfo definition. - :param expiration_time: Expiration time of registration token. - :type expiration_time: ~datetime.datetime - :param registration_token_operation: The type of resetting the token. Possible values include: + :ivar expiration_time: Expiration time of registration token. + :vartype expiration_time: ~datetime.datetime + :ivar registration_token_operation: The type of resetting the token. Possible values include: "Delete", "None", "Update". - :type registration_token_operation: str or - ~desktop_virtualization_api_client.models.RegistrationTokenOperation + :vartype registration_token_operation: str or + ~azure.mgmt.desktopvirtualization.models.RegistrationTokenOperation """ _attribute_map = { @@ -2033,6 +2739,14 @@ def __init__( registration_token_operation: Optional[Union[str, "RegistrationTokenOperation"]] = None, **kwargs ): + """ + :keyword expiration_time: Expiration time of registration token. + :paramtype expiration_time: ~datetime.datetime + :keyword registration_token_operation: The type of resetting the token. Possible values + include: "Delete", "None", "Update". + :paramtype registration_token_operation: str or + ~azure.mgmt.desktopvirtualization.models.RegistrationTokenOperation + """ super(RegistrationInfoPatch, self).__init__(**kwargs) self.expiration_time = expiration_time self.registration_token_operation = registration_token_operation @@ -2047,9 +2761,9 @@ class ResourceModelWithAllowedPropertySetIdentity(Identity): :vartype principal_id: str :ivar tenant_id: The tenant ID of resource. :vartype tenant_id: str - :param type: The identity type. The only acceptable values to pass in are None and + :ivar type: The identity type. The only acceptable values to pass in are None and "SystemAssigned". The default value is None. - :type type: str + :vartype type: str """ _validation = { @@ -2069,6 +2783,11 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :paramtype type: str + """ super(ResourceModelWithAllowedPropertySetIdentity, self).__init__(type=type, **kwargs) @@ -2077,19 +2796,19 @@ class ResourceModelWithAllowedPropertySetPlan(Plan): All required parameters must be populated in order to send to Azure. - :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. - :type name: str - :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. + :ivar name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :vartype name: str + :ivar publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. - :type publisher: str - :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product + :vartype publisher: str + :ivar product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. - :type product: str - :param promotion_code: A publisher provided promotion code as provisioned in Data Market for - the said product/artifact. - :type promotion_code: str - :param version: The version of the desired product/artifact. - :type version: str + :vartype product: str + :ivar promotion_code: A publisher provided promotion code as provisioned in Data Market for the + said product/artifact. + :vartype promotion_code: str + :ivar version: The version of the desired product/artifact. + :vartype version: str """ _validation = { @@ -2116,6 +2835,21 @@ def __init__( version: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :paramtype name: str + :keyword publisher: Required. The publisher of the 3rd Party Artifact that is being bought. + E.g. NewRelic. + :paramtype publisher: str + :keyword product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. + Product maps to the OfferID specified for the artifact at the time of Data Market onboarding. + :paramtype product: str + :keyword promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :paramtype promotion_code: str + :keyword version: The version of the desired product/artifact. + :paramtype version: str + """ super(ResourceModelWithAllowedPropertySetPlan, self).__init__(name=name, publisher=publisher, product=product, promotion_code=promotion_code, version=version, **kwargs) @@ -2124,21 +2858,21 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. - :type name: str - :param tier: This field is required to be implemented by the Resource Provider if the service + :ivar name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", "Standard", "Premium". - :type tier: str or ~desktop_virtualization_api_client.models.SkuTier - :param size: The SKU size. When the name field is the combination of tier and some other value, + :vartype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier + :ivar size: The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - :type size: str - :param family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :type family: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - :type capacity: int + :vartype capacity: int """ _validation = { @@ -2163,6 +2897,23 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + """ super(Sku, self).__init__(**kwargs) self.name = name self.tier = tier @@ -2176,21 +2927,21 @@ class ResourceModelWithAllowedPropertySetSku(Sku): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. - :type name: str - :param tier: This field is required to be implemented by the Resource Provider if the service + :ivar name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :vartype name: str + :ivar tier: This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", "Standard", "Premium". - :type tier: str or ~desktop_virtualization_api_client.models.SkuTier - :param size: The SKU size. When the name field is the combination of tier and some other value, + :vartype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier + :ivar size: The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. - :type size: str - :param family: If the service has different generations of hardware, for the same SKU, then - that can be captured here. - :type family: str - :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + :vartype size: str + :ivar family: If the service has different generations of hardware, for the same SKU, then that + can be captured here. + :vartype family: str + :ivar capacity: If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. - :type capacity: int + :vartype capacity: int """ _validation = { @@ -2215,20 +2966,37 @@ def __init__( capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :paramtype name: str + :keyword tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :paramtype tier: str or ~azure.mgmt.desktopvirtualization.models.SkuTier + :keyword size: The SKU size. When the name field is the combination of tier and some other + value, this would be the standalone code. + :paramtype size: str + :keyword family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :paramtype family: str + :keyword capacity: If the SKU supports scale out/in then the capacity integer should be + included. If scale out/in is not possible for the resource this may be omitted. + :paramtype capacity: int + """ super(ResourceModelWithAllowedPropertySetSku, self).__init__(name=name, tier=tier, size=size, family=family, capacity=capacity, **kwargs) class ResourceProviderOperation(msrest.serialization.Model): """Supported operation of this resource provider. - :param name: Operation name, in format of {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~desktop_virtualization_api_client.models.ResourceProviderOperationDisplay - :param is_data_action: Is a data action. - :type is_data_action: bool - :param properties: Properties of the operation. - :type properties: ~desktop_virtualization_api_client.models.OperationProperties + :ivar name: Operation name, in format of {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay + :ivar is_data_action: Is a data action. + :vartype is_data_action: bool + :ivar properties: Properties of the operation. + :vartype properties: ~azure.mgmt.desktopvirtualization.models.OperationProperties """ _attribute_map = { @@ -2247,6 +3015,16 @@ def __init__( properties: Optional["OperationProperties"] = None, **kwargs ): + """ + :keyword name: Operation name, in format of {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay + :keyword is_data_action: Is a data action. + :paramtype is_data_action: bool + :keyword properties: Properties of the operation. + :paramtype properties: ~azure.mgmt.desktopvirtualization.models.OperationProperties + """ super(ResourceProviderOperation, self).__init__(**kwargs) self.name = name self.display = display @@ -2257,14 +3035,14 @@ def __init__( class ResourceProviderOperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Resource provider: Microsoft Desktop Virtualization. - :type provider: str - :param resource: Resource on which the operation is performed. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Description of this operation. - :type description: str + :ivar provider: Resource provider: Microsoft Desktop Virtualization. + :vartype provider: str + :ivar resource: Resource on which the operation is performed. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Description of this operation. + :vartype description: str """ _attribute_map = { @@ -2283,6 +3061,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Resource provider: Microsoft Desktop Virtualization. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Description of this operation. + :paramtype description: str + """ super(ResourceProviderOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -2295,8 +3083,8 @@ class ResourceProviderOperationList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by this resource provider. - :type value: list[~desktop_virtualization_api_client.models.ResourceProviderOperation] + :ivar value: List of operations supported by this resource provider. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperation] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -2316,6 +3104,10 @@ def __init__( value: Optional[List["ResourceProviderOperation"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by this resource provider. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperation] + """ super(ResourceProviderOperationList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2324,10 +3116,10 @@ def __init__( class ScalingHostPoolReference(msrest.serialization.Model): """Scaling plan reference to hostpool. - :param host_pool_arm_path: Arm path of referenced hostpool. - :type host_pool_arm_path: str - :param scaling_plan_enabled: Is the scaling plan enabled for this hostpool. - :type scaling_plan_enabled: bool + :ivar host_pool_arm_path: Arm path of referenced hostpool. + :vartype host_pool_arm_path: str + :ivar scaling_plan_enabled: Is the scaling plan enabled for this hostpool. + :vartype scaling_plan_enabled: bool """ _attribute_map = { @@ -2342,6 +3134,12 @@ def __init__( scaling_plan_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword host_pool_arm_path: Arm path of referenced hostpool. + :paramtype host_pool_arm_path: str + :keyword scaling_plan_enabled: Is the scaling plan enabled for this hostpool. + :paramtype scaling_plan_enabled: bool + """ super(ScalingHostPoolReference, self).__init__(**kwargs) self.host_pool_arm_path = host_pool_arm_path self.scaling_plan_enabled = scaling_plan_enabled @@ -2360,51 +3158,51 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + :vartype managed_by: str + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - :type kind: str + :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: + :vartype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :ivar sku: + :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :ivar plan: + :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of scaling plan. (internal use). :vartype object_id: str - :param description: Description of scaling plan. - :type description: str - :param friendly_name: User friendly name of scaling plan. - :type friendly_name: str - :param time_zone: Timezone of the scaling plan. - :type time_zone: str - :param host_pool_type: HostPool type for desktop. Possible values include: "Pooled". - :type host_pool_type: str or ~desktop_virtualization_api_client.models.ScalingHostPoolType - :param exclusion_tag: Exclusion tag for scaling plan. - :type exclusion_tag: str - :param schedules: List of ScalingSchedule definitions. - :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] - :param host_pool_references: List of ScalingHostPoolReference definitions. - :type host_pool_references: - list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] + :ivar description: Description of scaling plan. + :vartype description: str + :ivar friendly_name: User friendly name of scaling plan. + :vartype friendly_name: str + :ivar time_zone: Timezone of the scaling plan. + :vartype time_zone: str + :ivar host_pool_type: HostPool type for desktop. Possible values include: "Pooled". + :vartype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.ScalingHostPoolType + :ivar exclusion_tag: Exclusion tag for scaling plan. + :vartype exclusion_tag: str + :ivar schedules: List of ScalingSchedule definitions. + :vartype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] + :ivar host_pool_references: List of ScalingHostPoolReference definitions. + :vartype host_pool_references: + list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] """ _validation = { @@ -2459,6 +3257,44 @@ def __init__( host_pool_references: Optional[List["ScalingHostPoolReference"]] = None, **kwargs ): + """ + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword managed_by: The fully qualified resource ID of the resource that manages this + resource. Indicates if this resource is managed by another Azure resource. If this is present, + complete mode deployment will not delete the resource if it is removed from the template since + it is managed by another resource. + :paramtype managed_by: str + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :paramtype kind: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: + :paramtype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :keyword sku: + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :keyword plan: + :paramtype plan: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword description: Description of scaling plan. + :paramtype description: str + :keyword friendly_name: User friendly name of scaling plan. + :paramtype friendly_name: str + :keyword time_zone: Timezone of the scaling plan. + :paramtype time_zone: str + :keyword host_pool_type: HostPool type for desktop. Possible values include: "Pooled". + :paramtype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.ScalingHostPoolType + :keyword exclusion_tag: Exclusion tag for scaling plan. + :paramtype exclusion_tag: str + :keyword schedules: List of ScalingSchedule definitions. + :paramtype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] + :keyword host_pool_references: List of ScalingHostPoolReference definitions. + :paramtype host_pool_references: + list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] + """ super(ScalingPlan, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) self.system_data = None self.object_id = None @@ -2476,8 +3312,8 @@ class ScalingPlanList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of scaling plan definitions. - :type value: list[~desktop_virtualization_api_client.models.ScalingPlan] + :ivar value: List of scaling plan definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlan] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -2497,6 +3333,10 @@ def __init__( value: Optional[List["ScalingPlan"]] = None, **kwargs ): + """ + :keyword value: List of scaling plan definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ScalingPlan] + """ super(ScalingPlanList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2505,21 +3345,21 @@ def __init__( class ScalingPlanPatch(msrest.serialization.Model): """Scaling plan properties that can be patched. - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of scaling plan. - :type description: str - :param friendly_name: User friendly name of scaling plan. - :type friendly_name: str - :param time_zone: Timezone of the scaling plan. - :type time_zone: str - :param exclusion_tag: Exclusion tag for scaling plan. - :type exclusion_tag: str - :param schedules: List of ScalingSchedule definitions. - :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] - :param host_pool_references: List of ScalingHostPoolReference definitions. - :type host_pool_references: - list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] + :ivar tags: A set of tags. tags to be updated. + :vartype tags: dict[str, str] + :ivar description: Description of scaling plan. + :vartype description: str + :ivar friendly_name: User friendly name of scaling plan. + :vartype friendly_name: str + :ivar time_zone: Timezone of the scaling plan. + :vartype time_zone: str + :ivar exclusion_tag: Exclusion tag for scaling plan. + :vartype exclusion_tag: str + :ivar schedules: List of ScalingSchedule definitions. + :vartype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] + :ivar host_pool_references: List of ScalingHostPoolReference definitions. + :vartype host_pool_references: + list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] """ _attribute_map = { @@ -2544,6 +3384,23 @@ def __init__( host_pool_references: Optional[List["ScalingHostPoolReference"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. tags to be updated. + :paramtype tags: dict[str, str] + :keyword description: Description of scaling plan. + :paramtype description: str + :keyword friendly_name: User friendly name of scaling plan. + :paramtype friendly_name: str + :keyword time_zone: Timezone of the scaling plan. + :paramtype time_zone: str + :keyword exclusion_tag: Exclusion tag for scaling plan. + :paramtype exclusion_tag: str + :keyword schedules: List of ScalingSchedule definitions. + :paramtype schedules: list[~azure.mgmt.desktopvirtualization.models.ScalingSchedule] + :keyword host_pool_references: List of ScalingHostPoolReference definitions. + :paramtype host_pool_references: + list[~azure.mgmt.desktopvirtualization.models.ScalingHostPoolReference] + """ super(ScalingPlanPatch, self).__init__(**kwargs) self.tags = tags self.description = description @@ -2557,53 +3414,54 @@ def __init__( class ScalingSchedule(msrest.serialization.Model): """Scaling plan schedule. - :param name: Name of the scaling schedule. - :type name: str - :param days_of_week: Set of days of the week on which this schedule is active. - :type days_of_week: list[str or - ~desktop_virtualization_api_client.models.ScalingScheduleDaysOfWeekItem] - :param ramp_up_start_time: Starting time for ramp up period. - :type ramp_up_start_time: ~desktop_virtualization_api_client.models.Time - :param ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Possible + :ivar name: Name of the scaling schedule. + :vartype name: str + :ivar days_of_week: Set of days of the week on which this schedule is active. + :vartype days_of_week: list[str or + ~azure.mgmt.desktopvirtualization.models.ScalingScheduleDaysOfWeekItem] + :ivar ramp_up_start_time: Starting time for ramp up period. + :vartype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :ivar ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Possible values include: "BreadthFirst", "DepthFirst". - :type ramp_up_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm - :param ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. - :type ramp_up_minimum_hosts_pct: int - :param ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. - :type ramp_up_capacity_threshold_pct: int - :param peak_start_time: Starting time for peak period. - :type peak_start_time: ~desktop_virtualization_api_client.models.Time - :param peak_load_balancing_algorithm: Load balancing algorithm for peak period. Possible values + :vartype ramp_up_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm + :ivar ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. + :vartype ramp_up_minimum_hosts_pct: int + :ivar ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. + :vartype ramp_up_capacity_threshold_pct: int + :ivar peak_start_time: Starting time for peak period. + :vartype peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :ivar peak_load_balancing_algorithm: Load balancing algorithm for peak period. Possible values include: "BreadthFirst", "DepthFirst". - :type peak_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm - :param ramp_down_start_time: Starting time for ramp down period. - :type ramp_down_start_time: ~desktop_virtualization_api_client.models.Time - :param ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. + :vartype peak_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm + :ivar ramp_down_start_time: Starting time for ramp down period. + :vartype ramp_down_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :ivar ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. Possible values include: "BreadthFirst", "DepthFirst". - :type ramp_down_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm - :param ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. - :type ramp_down_minimum_hosts_pct: int - :param ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. - :type ramp_down_capacity_threshold_pct: int - :param ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. - :type ramp_down_force_logoff_users: bool - :param ramp_down_stop_hosts_when: Specifies when to stop hosts during ramp down period. - Possible values include: "ZeroSessions", "ZeroActiveSessions". - :type ramp_down_stop_hosts_when: str or ~desktop_virtualization_api_client.models.StopHostsWhen - :param ramp_down_wait_time_minutes: Number of minutes to wait to stop hosts during ramp down + :vartype ramp_down_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm + :ivar ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. + :vartype ramp_down_minimum_hosts_pct: int + :ivar ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. + :vartype ramp_down_capacity_threshold_pct: int + :ivar ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. + :vartype ramp_down_force_logoff_users: bool + :ivar ramp_down_stop_hosts_when: Specifies when to stop hosts during ramp down period. Possible + values include: "ZeroSessions", "ZeroActiveSessions". + :vartype ramp_down_stop_hosts_when: str or + ~azure.mgmt.desktopvirtualization.models.StopHostsWhen + :ivar ramp_down_wait_time_minutes: Number of minutes to wait to stop hosts during ramp down period. - :type ramp_down_wait_time_minutes: int - :param ramp_down_notification_message: Notification message for users during ramp down period. - :type ramp_down_notification_message: str - :param off_peak_start_time: Starting time for off-peak period. - :type off_peak_start_time: ~desktop_virtualization_api_client.models.Time - :param off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. - Possible values include: "BreadthFirst", "DepthFirst". - :type off_peak_load_balancing_algorithm: str or - ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + :vartype ramp_down_wait_time_minutes: int + :ivar ramp_down_notification_message: Notification message for users during ramp down period. + :vartype ramp_down_notification_message: str + :ivar off_peak_start_time: Starting time for off-peak period. + :vartype off_peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :ivar off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. Possible + values include: "BreadthFirst", "DepthFirst". + :vartype off_peak_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm """ _validation = { @@ -2657,6 +3515,57 @@ def __init__( off_peak_load_balancing_algorithm: Optional[Union[str, "SessionHostLoadBalancingAlgorithm"]] = None, **kwargs ): + """ + :keyword name: Name of the scaling schedule. + :paramtype name: str + :keyword days_of_week: Set of days of the week on which this schedule is active. + :paramtype days_of_week: list[str or + ~azure.mgmt.desktopvirtualization.models.ScalingScheduleDaysOfWeekItem] + :keyword ramp_up_start_time: Starting time for ramp up period. + :paramtype ramp_up_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :keyword ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. + Possible values include: "BreadthFirst", "DepthFirst". + :paramtype ramp_up_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm + :keyword ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. + :paramtype ramp_up_minimum_hosts_pct: int + :keyword ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. + :paramtype ramp_up_capacity_threshold_pct: int + :keyword peak_start_time: Starting time for peak period. + :paramtype peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :keyword peak_load_balancing_algorithm: Load balancing algorithm for peak period. Possible + values include: "BreadthFirst", "DepthFirst". + :paramtype peak_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm + :keyword ramp_down_start_time: Starting time for ramp down period. + :paramtype ramp_down_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :keyword ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. + Possible values include: "BreadthFirst", "DepthFirst". + :paramtype ramp_down_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm + :keyword ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. + :paramtype ramp_down_minimum_hosts_pct: int + :keyword ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. + :paramtype ramp_down_capacity_threshold_pct: int + :keyword ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. + :paramtype ramp_down_force_logoff_users: bool + :keyword ramp_down_stop_hosts_when: Specifies when to stop hosts during ramp down period. + Possible values include: "ZeroSessions", "ZeroActiveSessions". + :paramtype ramp_down_stop_hosts_when: str or + ~azure.mgmt.desktopvirtualization.models.StopHostsWhen + :keyword ramp_down_wait_time_minutes: Number of minutes to wait to stop hosts during ramp down + period. + :paramtype ramp_down_wait_time_minutes: int + :keyword ramp_down_notification_message: Notification message for users during ramp down + period. + :paramtype ramp_down_notification_message: str + :keyword off_peak_start_time: Starting time for off-peak period. + :paramtype off_peak_start_time: ~azure.mgmt.desktopvirtualization.models.Time + :keyword off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. + Possible values include: "BreadthFirst", "DepthFirst". + :paramtype off_peak_load_balancing_algorithm: str or + ~azure.mgmt.desktopvirtualization.models.SessionHostLoadBalancingAlgorithm + """ super(ScalingSchedule, self).__init__(**kwargs) self.name = name self.days_of_week = days_of_week @@ -2681,10 +3590,10 @@ def __init__( class SendMessage(msrest.serialization.Model): """Represents message sent to a UserSession. - :param message_title: Title of message. - :type message_title: str - :param message_body: Body of message. - :type message_body: str + :ivar message_title: Title of message. + :vartype message_title: str + :ivar message_body: Body of message. + :vartype message_body: str """ _attribute_map = { @@ -2699,6 +3608,12 @@ def __init__( message_body: Optional[str] = None, **kwargs ): + """ + :keyword message_title: Title of message. + :paramtype message_title: str + :keyword message_body: Body of message. + :paramtype message_body: str + """ super(SendMessage, self).__init__(**kwargs) self.message_title = message_title self.message_body = message_body @@ -2707,8 +3622,8 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """Service specification payload. - :param log_specifications: Specifications of the Log for Azure Monitoring. - :type log_specifications: list[~desktop_virtualization_api_client.models.LogSpecification] + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.desktopvirtualization.models.LogSpecification] """ _attribute_map = { @@ -2721,6 +3636,10 @@ def __init__( log_specifications: Optional[List["LogSpecification"]] = None, **kwargs ): + """ + :keyword log_specifications: Specifications of the Log for Azure Monitoring. + :paramtype log_specifications: list[~azure.mgmt.desktopvirtualization.models.LogSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.log_specifications = log_specifications @@ -2739,44 +3658,46 @@ class SessionHost(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of SessionHost. (internal use). :vartype object_id: str - :param last_heart_beat: Last heart beat from SessionHost. - :type last_heart_beat: ~datetime.datetime - :param sessions: Number of sessions on SessionHost. - :type sessions: int - :param agent_version: Version of agent on SessionHost. - :type agent_version: str - :param allow_new_session: Allow a new session. - :type allow_new_session: bool + :ivar last_heart_beat: Last heart beat from SessionHost. + :vartype last_heart_beat: ~datetime.datetime + :ivar sessions: Number of sessions on SessionHost. + :vartype sessions: int + :ivar agent_version: Version of agent on SessionHost. + :vartype agent_version: str + :ivar allow_new_session: Allow a new session. + :vartype allow_new_session: bool :ivar virtual_machine_id: Virtual Machine Id of SessionHost's underlying virtual machine. :vartype virtual_machine_id: str :ivar resource_id: Resource Id of SessionHost's underlying virtual machine. :vartype resource_id: str - :param assigned_user: User assigned to SessionHost. - :type assigned_user: str - :param status: Status for a SessionHost. Possible values include: "Available", "Unavailable", + :ivar assigned_user: User assigned to SessionHost. + :vartype assigned_user: str + :ivar friendly_name: Friendly name of SessionHost. + :vartype friendly_name: str + :ivar status: Status for a SessionHost. Possible values include: "Available", "Unavailable", "Shutdown", "Disconnected", "Upgrading", "UpgradeFailed", "NoHeartbeat", "NotJoinedToDomain", "DomainTrustRelationshipLost", "SxSStackListenerNotReady", "FSLogixNotHealthy", "NeedsAssistance". - :type status: str or ~desktop_virtualization_api_client.models.Status + :vartype status: str or ~azure.mgmt.desktopvirtualization.models.Status :ivar status_timestamp: The timestamp of the status. :vartype status_timestamp: ~datetime.datetime - :param os_version: The version of the OS on the session host. - :type os_version: str - :param sx_s_stack_version: The version of the side by side stack on the session host. - :type sx_s_stack_version: str - :param update_state: Update state of a SessionHost. Possible values include: "Initial", + :ivar os_version: The version of the OS on the session host. + :vartype os_version: str + :ivar sx_s_stack_version: The version of the side by side stack on the session host. + :vartype sx_s_stack_version: str + :ivar update_state: Update state of a SessionHost. Possible values include: "Initial", "Pending", "Started", "Succeeded", "Failed". - :type update_state: str or ~desktop_virtualization_api_client.models.UpdateState + :vartype update_state: str or ~azure.mgmt.desktopvirtualization.models.UpdateState :ivar last_update_time: The timestamp of the last update. :vartype last_update_time: ~datetime.datetime - :param update_error_message: The error message. - :type update_error_message: str + :ivar update_error_message: The error message. + :vartype update_error_message: str :ivar session_host_health_check_results: List of SessionHostHealthCheckReports. :vartype session_host_health_check_results: - list[~desktop_virtualization_api_client.models.SessionHostHealthCheckReport] + list[~azure.mgmt.desktopvirtualization.models.SessionHostHealthCheckReport] """ _validation = { @@ -2805,6 +3726,7 @@ class SessionHost(Resource): 'virtual_machine_id': {'key': 'properties.virtualMachineId', 'type': 'str'}, 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, 'status': {'key': 'properties.status', 'type': 'str'}, 'status_timestamp': {'key': 'properties.statusTimestamp', 'type': 'iso-8601'}, 'os_version': {'key': 'properties.osVersion', 'type': 'str'}, @@ -2823,6 +3745,7 @@ def __init__( agent_version: Optional[str] = None, allow_new_session: Optional[bool] = None, assigned_user: Optional[str] = None, + friendly_name: Optional[str] = None, status: Optional[Union[str, "Status"]] = None, os_version: Optional[str] = None, sx_s_stack_version: Optional[str] = None, @@ -2830,6 +3753,34 @@ def __init__( update_error_message: Optional[str] = None, **kwargs ): + """ + :keyword last_heart_beat: Last heart beat from SessionHost. + :paramtype last_heart_beat: ~datetime.datetime + :keyword sessions: Number of sessions on SessionHost. + :paramtype sessions: int + :keyword agent_version: Version of agent on SessionHost. + :paramtype agent_version: str + :keyword allow_new_session: Allow a new session. + :paramtype allow_new_session: bool + :keyword assigned_user: User assigned to SessionHost. + :paramtype assigned_user: str + :keyword friendly_name: Friendly name of SessionHost. + :paramtype friendly_name: str + :keyword status: Status for a SessionHost. Possible values include: "Available", "Unavailable", + "Shutdown", "Disconnected", "Upgrading", "UpgradeFailed", "NoHeartbeat", "NotJoinedToDomain", + "DomainTrustRelationshipLost", "SxSStackListenerNotReady", "FSLogixNotHealthy", + "NeedsAssistance". + :paramtype status: str or ~azure.mgmt.desktopvirtualization.models.Status + :keyword os_version: The version of the OS on the session host. + :paramtype os_version: str + :keyword sx_s_stack_version: The version of the side by side stack on the session host. + :paramtype sx_s_stack_version: str + :keyword update_state: Update state of a SessionHost. Possible values include: "Initial", + "Pending", "Started", "Succeeded", "Failed". + :paramtype update_state: str or ~azure.mgmt.desktopvirtualization.models.UpdateState + :keyword update_error_message: The error message. + :paramtype update_error_message: str + """ super(SessionHost, self).__init__(**kwargs) self.system_data = None self.object_id = None @@ -2840,6 +3791,7 @@ def __init__( self.virtual_machine_id = None self.resource_id = None self.assigned_user = assigned_user + self.friendly_name = friendly_name self.status = status self.status_timestamp = None self.os_version = os_version @@ -2879,6 +3831,8 @@ def __init__( self, **kwargs ): + """ + """ super(SessionHostHealthCheckFailureDetails, self).__init__(**kwargs) self.message = None self.error_code = None @@ -2895,15 +3849,14 @@ class SessionHostHealthCheckReport(msrest.serialization.Model): "SxSStackListenerCheck", "UrlsAccessibleCheck", "MonitoringAgentCheck", "DomainReachable", "WebRTCRedirectorCheck", "SupportedEncryptionCheck", "MetaDataServiceCheck", "AppAttachHealthCheck". - :vartype health_check_name: str or ~desktop_virtualization_api_client.models.HealthCheckName + :vartype health_check_name: str or ~azure.mgmt.desktopvirtualization.models.HealthCheckName :ivar health_check_result: Represents the Health state of the health check we performed. Possible values include: "Unknown", "HealthCheckSucceeded", "HealthCheckFailed", "SessionHostShutdown". - :vartype health_check_result: str or - ~desktop_virtualization_api_client.models.HealthCheckResult + :vartype health_check_result: str or ~azure.mgmt.desktopvirtualization.models.HealthCheckResult :ivar additional_failure_details: Additional detailed information on the failure. :vartype additional_failure_details: - ~desktop_virtualization_api_client.models.SessionHostHealthCheckFailureDetails + ~azure.mgmt.desktopvirtualization.models.SessionHostHealthCheckFailureDetails """ _validation = { @@ -2922,6 +3875,8 @@ def __init__( self, **kwargs ): + """ + """ super(SessionHostHealthCheckReport, self).__init__(**kwargs) self.health_check_name = None self.health_check_result = None @@ -2933,8 +3888,8 @@ class SessionHostList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of SessionHost definitions. - :type value: list[~desktop_virtualization_api_client.models.SessionHost] + :ivar value: List of SessionHost definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHost] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -2954,6 +3909,10 @@ def __init__( value: Optional[List["SessionHost"]] = None, **kwargs ): + """ + :keyword value: List of SessionHost definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHost] + """ super(SessionHostList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2972,10 +3931,12 @@ class SessionHostPatch(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param allow_new_session: Allow a new session. - :type allow_new_session: bool - :param assigned_user: User assigned to SessionHost. - :type assigned_user: str + :ivar allow_new_session: Allow a new session. + :vartype allow_new_session: bool + :ivar assigned_user: User assigned to SessionHost. + :vartype assigned_user: str + :ivar friendly_name: Friendly name of SessionHost. + :vartype friendly_name: str """ _validation = { @@ -2990,6 +3951,7 @@ class SessionHostPatch(Resource): 'type': {'key': 'type', 'type': 'str'}, 'allow_new_session': {'key': 'properties.allowNewSession', 'type': 'bool'}, 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, } def __init__( @@ -2997,11 +3959,21 @@ def __init__( *, allow_new_session: Optional[bool] = None, assigned_user: Optional[str] = None, + friendly_name: Optional[str] = None, **kwargs ): + """ + :keyword allow_new_session: Allow a new session. + :paramtype allow_new_session: bool + :keyword assigned_user: User assigned to SessionHost. + :paramtype assigned_user: str + :keyword friendly_name: Friendly name of SessionHost. + :paramtype friendly_name: str + """ super(SessionHostPatch, self).__init__(**kwargs) self.allow_new_session = allow_new_session self.assigned_user = assigned_user + self.friendly_name = friendly_name class StartMenuItem(Resource): @@ -3017,16 +3989,16 @@ class StartMenuItem(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param app_alias: Alias of StartMenuItem. - :type app_alias: str - :param file_path: Path to the file of StartMenuItem. - :type file_path: str - :param command_line_arguments: Command line arguments for StartMenuItem. - :type command_line_arguments: str - :param icon_path: Path to the icon. - :type icon_path: str - :param icon_index: Index of the icon. - :type icon_index: int + :ivar app_alias: Alias of StartMenuItem. + :vartype app_alias: str + :ivar file_path: Path to the file of StartMenuItem. + :vartype file_path: str + :ivar command_line_arguments: Command line arguments for StartMenuItem. + :vartype command_line_arguments: str + :ivar icon_path: Path to the icon. + :vartype icon_path: str + :ivar icon_index: Index of the icon. + :vartype icon_index: int """ _validation = { @@ -3056,6 +4028,18 @@ def __init__( icon_index: Optional[int] = None, **kwargs ): + """ + :keyword app_alias: Alias of StartMenuItem. + :paramtype app_alias: str + :keyword file_path: Path to the file of StartMenuItem. + :paramtype file_path: str + :keyword command_line_arguments: Command line arguments for StartMenuItem. + :paramtype command_line_arguments: str + :keyword icon_path: Path to the icon. + :paramtype icon_path: str + :keyword icon_index: Index of the icon. + :paramtype icon_index: int + """ super(StartMenuItem, self).__init__(**kwargs) self.app_alias = app_alias self.file_path = file_path @@ -3069,8 +4053,8 @@ class StartMenuItemList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of StartMenuItem definitions. - :type value: list[~desktop_virtualization_api_client.models.StartMenuItem] + :ivar value: List of StartMenuItem definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.StartMenuItem] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -3090,6 +4074,10 @@ def __init__( value: Optional[List["StartMenuItem"]] = None, **kwargs ): + """ + :keyword value: List of StartMenuItem definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.StartMenuItem] + """ super(StartMenuItemList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -3098,20 +4086,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :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. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.desktopvirtualization.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. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.desktopvirtualization.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3134,6 +4122,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :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. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.desktopvirtualization.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. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.desktopvirtualization.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3148,10 +4152,10 @@ class Time(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param hour: Required. The hour. - :type hour: int - :param minute: Required. The minute. - :type minute: int + :ivar hour: Required. The hour. + :vartype hour: int + :ivar minute: Required. The minute. + :vartype minute: int """ _validation = { @@ -3171,6 +4175,12 @@ def __init__( minute: int, **kwargs ): + """ + :keyword hour: Required. The hour. + :paramtype hour: int + :keyword minute: Required. The minute. + :paramtype minute: int + """ super(Time, self).__init__(**kwargs) self.hour = hour self.minute = minute @@ -3190,21 +4200,21 @@ class UserSession(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of user session. (internal use). :vartype object_id: str - :param user_principal_name: The user principal name. - :type user_principal_name: str - :param application_type: Application type of application. Possible values include: "RemoteApp", + :ivar user_principal_name: The user principal name. + :vartype user_principal_name: str + :ivar application_type: Application type of application. Possible values include: "RemoteApp", "Desktop". - :type application_type: str or ~desktop_virtualization_api_client.models.ApplicationType - :param session_state: State of user session. Possible values include: "Unknown", "Active", + :vartype application_type: str or ~azure.mgmt.desktopvirtualization.models.ApplicationType + :ivar session_state: State of user session. Possible values include: "Unknown", "Active", "Disconnected", "Pending", "LogOff", "UserProfileDiskMounted". - :type session_state: str or ~desktop_virtualization_api_client.models.SessionState - :param active_directory_user_name: The active directory user name. - :type active_directory_user_name: str - :param create_time: The timestamp of the user session create. - :type create_time: ~datetime.datetime + :vartype session_state: str or ~azure.mgmt.desktopvirtualization.models.SessionState + :ivar active_directory_user_name: The active directory user name. + :vartype active_directory_user_name: str + :ivar create_time: The timestamp of the user session create. + :vartype create_time: ~datetime.datetime """ _validation = { @@ -3238,6 +4248,20 @@ def __init__( create_time: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword user_principal_name: The user principal name. + :paramtype user_principal_name: str + :keyword application_type: Application type of application. Possible values include: + "RemoteApp", "Desktop". + :paramtype application_type: str or ~azure.mgmt.desktopvirtualization.models.ApplicationType + :keyword session_state: State of user session. Possible values include: "Unknown", "Active", + "Disconnected", "Pending", "LogOff", "UserProfileDiskMounted". + :paramtype session_state: str or ~azure.mgmt.desktopvirtualization.models.SessionState + :keyword active_directory_user_name: The active directory user name. + :paramtype active_directory_user_name: str + :keyword create_time: The timestamp of the user session create. + :paramtype create_time: ~datetime.datetime + """ super(UserSession, self).__init__(**kwargs) self.system_data = None self.object_id = None @@ -3253,8 +4277,8 @@ class UserSessionList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of UserSession definitions. - :type value: list[~desktop_virtualization_api_client.models.UserSession] + :ivar value: List of UserSession definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.UserSession] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -3274,6 +4298,10 @@ def __init__( value: Optional[List["UserSession"]] = None, **kwargs ): + """ + :keyword value: List of UserSession definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.UserSession] + """ super(UserSessionList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -3292,49 +4320,53 @@ class Workspace(ResourceModelWithAllowedPropertySet): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: The geo-location where the resource lives. - :type location: str - :param managed_by: The fully qualified resource ID of the resource that manages this resource. + :ivar location: The geo-location where the resource lives. + :vartype location: str + :ivar managed_by: The fully qualified resource ID of the resource that manages this resource. Indicates if this resource is managed by another Azure resource. If this is present, complete mode deployment will not delete the resource if it is removed from the template since it is managed by another resource. - :type managed_by: str - :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + :vartype managed_by: str + :ivar kind: Metadata used by portal/tooling/etc to render different UX experiences for resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must validate and persist this value. - :type kind: str + :vartype kind: str :ivar etag: The etag field is *not* required. If it is provided in the response body, it must also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype etag: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param identity: - :type identity: - ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity - :param sku: - :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku - :param plan: - :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar identity: + :vartype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :ivar sku: + :vartype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :ivar plan: + :vartype plan: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Workspace. (internal use). :vartype object_id: str - :param description: Description of Workspace. - :type description: str - :param friendly_name: Friendly name of Workspace. - :type friendly_name: str - :param application_group_references: List of applicationGroup resource Ids. - :type application_group_references: list[str] + :ivar description: Description of Workspace. + :vartype description: str + :ivar friendly_name: Friendly name of Workspace. + :vartype friendly_name: str + :ivar application_group_references: List of applicationGroup resource Ids. + :vartype application_group_references: list[str] :ivar cloud_pc_resource: Is cloud pc resource. :vartype cloud_pc_resource: bool - :param public_network_access: Enabled allows this resource to be accessed from both public and + :ivar public_network_access: Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess + :vartype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess + :ivar private_endpoint_connections: List of private endpoint connection associated with the + specified resource. + :vartype private_endpoint_connections: + list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection] """ _validation = { @@ -3346,6 +4378,7 @@ class Workspace(ResourceModelWithAllowedPropertySet): 'system_data': {'readonly': True}, 'object_id': {'readonly': True}, 'cloud_pc_resource': {'readonly': True}, + 'private_endpoint_connections': {'readonly': True}, } _attribute_map = { @@ -3367,6 +4400,7 @@ class Workspace(ResourceModelWithAllowedPropertySet): 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, } def __init__( @@ -3385,6 +4419,40 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword location: The geo-location where the resource lives. + :paramtype location: str + :keyword managed_by: The fully qualified resource ID of the resource that manages this + resource. Indicates if this resource is managed by another Azure resource. If this is present, + complete mode deployment will not delete the resource if it is removed from the template since + it is managed by another resource. + :paramtype managed_by: str + :keyword kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :paramtype kind: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword identity: + :paramtype identity: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetIdentity + :keyword sku: + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetSku + :keyword plan: + :paramtype plan: + ~azure.mgmt.desktopvirtualization.models.ResourceModelWithAllowedPropertySetPlan + :keyword description: Description of Workspace. + :paramtype description: str + :keyword friendly_name: Friendly name of Workspace. + :paramtype friendly_name: str + :keyword application_group_references: List of applicationGroup resource Ids. + :paramtype application_group_references: list[str] + :keyword public_network_access: Enabled allows this resource to be accessed from both public + and private networks, Disabled allows this resource to only be accessed via private endpoints. + Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess + """ super(Workspace, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) self.system_data = None self.object_id = None @@ -3393,6 +4461,7 @@ def __init__( self.application_group_references = application_group_references self.cloud_pc_resource = None self.public_network_access = public_network_access + self.private_endpoint_connections = None class WorkspaceList(msrest.serialization.Model): @@ -3400,8 +4469,8 @@ class WorkspaceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of Workspace definitions. - :type value: list[~desktop_virtualization_api_client.models.Workspace] + :ivar value: List of Workspace definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.Workspace] :ivar next_link: Link to the next page of results. :vartype next_link: str """ @@ -3421,6 +4490,10 @@ def __init__( value: Optional[List["Workspace"]] = None, **kwargs ): + """ + :keyword value: List of Workspace definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.Workspace] + """ super(WorkspaceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -3429,18 +4502,18 @@ def __init__( class WorkspacePatch(msrest.serialization.Model): """Workspace properties that can be patched. - :param tags: A set of tags. tags to be updated. - :type tags: dict[str, str] - :param description: Description of Workspace. - :type description: str - :param friendly_name: Friendly name of Workspace. - :type friendly_name: str - :param application_group_references: List of applicationGroup links. - :type application_group_references: list[str] - :param public_network_access: Enabled to allow this resource to be access from the public + :ivar tags: A set of tags. tags to be updated. + :vartype tags: dict[str, str] + :ivar description: Description of Workspace. + :vartype description: str + :ivar friendly_name: Friendly name of Workspace. + :vartype friendly_name: str + :ivar application_group_references: List of applicationGroup links. + :vartype application_group_references: list[str] + :ivar public_network_access: Enabled to allow this resource to be access from the public network. Possible values include: "Enabled", "Disabled". - :type public_network_access: str or - ~desktop_virtualization_api_client.models.PublicNetworkAccess + :vartype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess """ _attribute_map = { @@ -3461,6 +4534,20 @@ def __init__( public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. tags to be updated. + :paramtype tags: dict[str, str] + :keyword description: Description of Workspace. + :paramtype description: str + :keyword friendly_name: Friendly name of Workspace. + :paramtype friendly_name: str + :keyword application_group_references: List of applicationGroup links. + :paramtype application_group_references: list[str] + :keyword public_network_access: Enabled to allow this resource to be access from the public + network. Possible values include: "Enabled", "Disabled". + :paramtype public_network_access: str or + ~azure.mgmt.desktopvirtualization.models.PublicNetworkAccess + """ super(WorkspacePatch, self).__init__(**kwargs) self.tags = tags self.description = description diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py index 35d423413cb7..dd74cdfe6c9a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,259 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ApplicationGroupsOperations(object): """ApplicationGroupsOperations operations. @@ -30,7 +267,7 @@ class ApplicationGroupsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +282,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - application_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationGroup" + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> "_models.ApplicationGroup": """Get an application group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +297,7 @@ def get( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] @@ -68,28 +305,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,16 +336,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - application_group_name, # type: str - application_group, # type: "_models.ApplicationGroup" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationGroup" + resource_group_name: str, + application_group_name: str, + application_group: "_models.ApplicationGroup", + **kwargs: Any + ) -> "_models.ApplicationGroup": """Create or update an applicationGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -119,10 +355,10 @@ def create_or_update( :param application_group_name: The name of the application group. :type application_group_name: str :param application_group: Object containing ApplicationGroup definitions. - :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroup + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] @@ -130,33 +366,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(application_group, 'ApplicationGroup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(application_group, 'ApplicationGroup') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -173,15 +405,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore - def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - application_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> None: """Remove an applicationGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -198,28 +432,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -229,27 +460,29 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - application_group_name, # type: str - application_group=None, # type: Optional["_models.ApplicationGroupPatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationGroup" + resource_group_name: str, + application_group_name: str, + application_group: Optional["_models.ApplicationGroupPatch"] = None, + **kwargs: Any + ) -> "_models.ApplicationGroup": """Update an applicationGroup. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param application_group_name: The name of the application group. :type application_group_name: str - :param application_group: Object containing ApplicationGroup definitions. - :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroupPatch + :param application_group: Object containing ApplicationGroup definitions. Default value is + None. + :type application_group: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationGroup, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] @@ -257,36 +490,32 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if application_group is not None: - body_content = self._serialize.body(application_group, 'ApplicationGroupPatch') + _json = self._serialize.body(application_group, 'ApplicationGroupPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -299,63 +528,67 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApplicationGroupList"] + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ApplicationGroupList"]: """List applicationGroups. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param filter: OData filter expression. Valid properties for filtering are - applicationGroupType. + applicationGroupType. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :return: An iterator like instance of either ApplicationGroupList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + 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('ApplicationGroupList', pipeline_response) + deserialized = self._deserialize("ApplicationGroupList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -364,7 +597,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -373,62 +610,64 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups"} # type: ignore + @distributed_trace def list_by_subscription( self, - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApplicationGroupList"] + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ApplicationGroupList"]: """List applicationGroups in subscription. :param filter: OData filter expression. Valid properties for filtering are - applicationGroupType. + applicationGroupType. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :return: An iterator like instance of either ApplicationGroupList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationGroupList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + 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('ApplicationGroupList', pipeline_response) + deserialized = self._deserialize("ApplicationGroupList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -437,7 +676,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -446,7 +689,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py index 59dd6449ed15..1b8b38a67488 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,229 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ApplicationsOperations(object): """ApplicationsOperations operations. @@ -30,7 +237,7 @@ class ApplicationsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - application_group_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" + resource_group_name: str, + application_group_name: str, + application_name: str, + **kwargs: Any + ) -> "_models.Application": """Get an application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,7 +270,7 @@ def get( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Application + :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] @@ -71,29 +278,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,17 +310,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - application_group_name, # type: str - application_name, # type: str - application, # type: "_models.Application" - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" + resource_group_name: str, + application_group_name: str, + application_name: str, + application: "_models.Application", + **kwargs: Any + ) -> "_models.Application": """Create or update an application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -126,10 +332,10 @@ def create_or_update( :param application_name: The name of the application within the specified application group. :type application_name: str :param application: Object containing Application definitions. - :type application: ~desktop_virtualization_api_client.models.Application + :type application: ~azure.mgmt.desktopvirtualization.models.Application :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Application + :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] @@ -137,34 +343,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(application, 'Application') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(application, 'Application') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -181,16 +383,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore - def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - application_group_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + application_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: """Remove an application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -209,29 +413,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -241,17 +442,18 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - application_group_name, # type: str - application_name, # type: str - application=None, # type: Optional["_models.ApplicationPatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.Application" + resource_group_name: str, + application_group_name: str, + application_name: str, + application: Optional["_models.ApplicationPatch"] = None, + **kwargs: Any + ) -> "_models.Application": """Update an application. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -260,11 +462,11 @@ def update( :type application_group_name: str :param application_name: The name of the application within the specified application group. :type application_name: str - :param application: Object containing Application definitions. - :type application: ~desktop_virtualization_api_client.models.ApplicationPatch + :param application: Object containing Application definitions. Default value is None. + :type application: ~azure.mgmt.desktopvirtualization.models.ApplicationPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Application, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Application + :rtype: ~azure.mgmt.desktopvirtualization.models.Application :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] @@ -272,37 +474,33 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if application is not None: - body_content = self._serialize.body(application, 'ApplicationPatch') + _json = self._serialize.body(application, 'ApplicationPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -315,15 +513,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def list( self, - resource_group_name, # type: str - application_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApplicationList"] + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ApplicationList"]: """List applications. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -332,44 +532,45 @@ def list( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ApplicationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ApplicationList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ApplicationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('ApplicationList', pipeline_response) + deserialized = self._deserialize("ApplicationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -378,7 +579,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -387,7 +592,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py index 2a315452e564..ed6d5ebdb981 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,145 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + desktop_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + "desktopName": _SERIALIZER.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + desktop_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + "desktopName": _SERIALIZER.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class DesktopsOperations(object): """DesktopsOperations operations. @@ -30,7 +153,7 @@ class DesktopsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +168,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - application_group_name, # type: str - desktop_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Desktop" + resource_group_name: str, + application_group_name: str, + desktop_name: str, + **kwargs: Any + ) -> "_models.Desktop": """Get a desktop. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,7 +186,7 @@ def get( :type desktop_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Desktop + :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] @@ -71,29 +194,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + desktop_name=desktop_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,17 +226,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}"} # type: ignore + + + @distributed_trace def update( self, - resource_group_name, # type: str - application_group_name, # type: str - desktop_name, # type: str - desktop=None, # type: Optional["_models.DesktopPatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.Desktop" + resource_group_name: str, + application_group_name: str, + desktop_name: str, + desktop: Optional["_models.DesktopPatch"] = None, + **kwargs: Any + ) -> "_models.Desktop": """Update a desktop. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -125,11 +247,11 @@ def update( :type application_group_name: str :param desktop_name: The name of the desktop within the specified desktop group. :type desktop_name: str - :param desktop: Object containing Desktop definitions. - :type desktop: ~desktop_virtualization_api_client.models.DesktopPatch + :param desktop: Object containing Desktop definitions. Default value is None. + :type desktop: ~azure.mgmt.desktopvirtualization.models.DesktopPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Desktop, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Desktop + :rtype: ~azure.mgmt.desktopvirtualization.models.Desktop :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] @@ -137,37 +259,33 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if desktop is not None: - body_content = self._serialize.body(desktop, 'DesktopPatch') + _json = self._serialize.body(desktop, 'DesktopPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + desktop_name=desktop_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -180,15 +298,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}"} # type: ignore + + + @distributed_trace def list( self, - resource_group_name, # type: str - application_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.DesktopList"] + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> Iterable["_models.DesktopList"]: """List desktops. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -197,44 +317,45 @@ def list( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either DesktopList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.DesktopList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.DesktopList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.DesktopList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('DesktopList', pipeline_response) + deserialized = self._deserialize("DesktopList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -243,7 +364,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -252,7 +377,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py index 12f946b4b400..67a0627d9f34 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,291 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + _query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_retrieve_registration_token_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class HostPoolsOperations(object): """HostPoolsOperations operations. @@ -30,7 +299,7 @@ class HostPoolsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +314,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - host_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.HostPool" + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> "_models.HostPool": """Get a host pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +329,7 @@ def get( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.HostPool + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] @@ -68,28 +337,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,16 +368,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - host_pool_name, # type: str - host_pool, # type: "_models.HostPool" - **kwargs # type: Any - ): - # type: (...) -> "_models.HostPool" + resource_group_name: str, + host_pool_name: str, + host_pool: "_models.HostPool", + **kwargs: Any + ) -> "_models.HostPool": """Create or update a host pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -119,10 +387,10 @@ def create_or_update( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :param host_pool: Object containing HostPool definitions. - :type host_pool: ~desktop_virtualization_api_client.models.HostPool + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPool :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.HostPool + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] @@ -130,33 +398,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(host_pool, 'HostPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(host_pool, 'HostPool') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -173,23 +437,25 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore - def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - host_pool_name, # type: str - force=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_pool_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: """Remove a host pool. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str - :param force: Force flag to delete sessionHost. + :param force: Force flag to delete sessionHost. Default value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -201,30 +467,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -234,27 +496,28 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_pool_name, # type: str - host_pool=None, # type: Optional["_models.HostPoolPatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.HostPool" + resource_group_name: str, + host_pool_name: str, + host_pool: Optional["_models.HostPoolPatch"] = None, + **kwargs: Any + ) -> "_models.HostPool": """Update a host pool. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str - :param host_pool: Object containing HostPool definitions. - :type host_pool: ~desktop_virtualization_api_client.models.HostPoolPatch + :param host_pool: Object containing HostPool definitions. Default value is None. + :type host_pool: ~azure.mgmt.desktopvirtualization.models.HostPoolPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: HostPool, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.HostPool + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPool :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] @@ -262,36 +525,32 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if host_pool is not None: - body_content = self._serialize.body(host_pool, 'HostPoolPatch') + _json = self._serialize.body(host_pool, 'HostPoolPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -304,57 +563,59 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.HostPoolList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.HostPoolList"]: """List hostPools. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPoolList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.HostPoolList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('HostPoolList', pipeline_response) + deserialized = self._deserialize("HostPoolList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -363,7 +624,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -372,56 +637,56 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools"} # type: ignore + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.HostPoolList"] + **kwargs: Any + ) -> Iterable["_models.HostPoolList"]: """List hostPools in subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either HostPoolList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.HostPoolList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('HostPoolList', pipeline_response) + deserialized = self._deserialize("HostPoolList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -430,7 +695,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -439,18 +708,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools"} # type: ignore + @distributed_trace def retrieve_registration_token( self, - resource_group_name, # type: str - host_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RegistrationInfo" + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> "_models.RegistrationInfo": """Registration token of the host pool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -459,7 +729,7 @@ def retrieve_registration_token( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: RegistrationInfo, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.RegistrationInfo + :rtype: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistrationInfo"] @@ -467,28 +737,25 @@ def retrieve_registration_token( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.retrieve_registration_token.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_retrieve_registration_token_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.retrieve_registration_token.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -501,4 +768,6 @@ def retrieve_registration_token( return cls(pipeline_response, deserialized, {}) return deserialized - retrieve_registration_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken'} # type: ignore + + retrieve_registration_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken"} # type: ignore + diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py index 4b3888285aae..db78ea173817 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,69 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_expand_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class MsixImagesOperations(object): """MsixImagesOperations operations. @@ -30,7 +77,7 @@ class MsixImagesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +92,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def expand( self, - resource_group_name, # type: str - host_pool_name, # type: str - msix_image_uri, # type: "_models.MSIXImageURI" - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExpandMsixImageList"] + resource_group_name: str, + host_pool_name: str, + msix_image_uri: "_models.MSIXImageURI", + **kwargs: Any + ) -> Iterable["_models.ExpandMsixImageList"]: """Expands and Lists MSIX packages in an Image, given the Image Path. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,55 +107,56 @@ def expand( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :param msix_image_uri: Object containing URI to MSIX Image. - :type msix_image_uri: ~desktop_virtualization_api_client.models.MSIXImageURI + :type msix_image_uri: ~azure.mgmt.desktopvirtualization.models.MSIXImageURI :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ExpandMsixImageList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ExpandMsixImageList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ExpandMsixImageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpandMsixImageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = "application/json" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.expand.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = self._serialize.body(msix_image_uri, 'MSIXImageURI') + + request = build_expand_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.expand.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') - body_content_kwargs['content'] = body_content - request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + _json = self._serialize.body(msix_image_uri, 'MSIXImageURI') + + request = build_expand_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=next_link, + ) + 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('ExpandMsixImageList', pipeline_response) + deserialized = self._deserialize("ExpandMsixImageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,7 +165,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -126,7 +178,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage'} # type: ignore + expand.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py index 140e1fe0cf52..2831ed70dcb9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,229 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "msixPackageFullName": _SERIALIZER.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "msixPackageFullName": _SERIALIZER.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "msixPackageFullName": _SERIALIZER.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "msixPackageFullName": _SERIALIZER.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class MSIXPackagesOperations(object): """MSIXPackagesOperations operations. @@ -30,7 +237,7 @@ class MSIXPackagesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +252,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - host_pool_name, # type: str - msix_package_full_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.MSIXPackage" + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + **kwargs: Any + ) -> "_models.MSIXPackage": """Get a msixpackage. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -64,7 +271,7 @@ def get( :type msix_package_full_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] @@ -72,29 +279,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,17 +311,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - host_pool_name, # type: str - msix_package_full_name, # type: str - msix_package, # type: "_models.MSIXPackage" - **kwargs # type: Any - ): - # type: (...) -> "_models.MSIXPackage" + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + msix_package: "_models.MSIXPackage", + **kwargs: Any + ) -> "_models.MSIXPackage": """Create or update a MSIX package. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -128,10 +334,10 @@ def create_or_update( within specified hostpool. :type msix_package_full_name: str :param msix_package: Object containing MSIX Package definitions. - :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackage + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] @@ -139,34 +345,30 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(msix_package, 'MSIXPackage') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(msix_package, 'MSIXPackage') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -183,16 +385,18 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore - def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - host_pool_name, # type: str - msix_package_full_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + **kwargs: Any + ) -> None: """Remove an MSIX Package. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -212,29 +416,26 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -244,17 +445,18 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_pool_name, # type: str - msix_package_full_name, # type: str - msix_package=None, # type: Optional["_models.MSIXPackagePatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.MSIXPackage" + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + msix_package: Optional["_models.MSIXPackagePatch"] = None, + **kwargs: Any + ) -> "_models.MSIXPackage": """Update an MSIX Package. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -264,11 +466,11 @@ def update( :param msix_package_full_name: The version specific package full name of the MSIX package within specified hostpool. :type msix_package_full_name: str - :param msix_package: Object containing MSIX Package definitions. - :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackagePatch + :param msix_package: Object containing MSIX Package definitions. Default value is None. + :type msix_package: ~azure.mgmt.desktopvirtualization.models.MSIXPackagePatch :keyword callable cls: A custom type or function that will be passed the direct response :return: MSIXPackage, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :rtype: ~azure.mgmt.desktopvirtualization.models.MSIXPackage :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] @@ -276,37 +478,33 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if msix_package is not None: - body_content = self._serialize.body(msix_package, 'MSIXPackagePatch') + _json = self._serialize.body(msix_package, 'MSIXPackagePatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + msix_package_full_name=msix_package_full_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -319,15 +517,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}"} # type: ignore + + + @distributed_trace def list( self, - resource_group_name, # type: str - host_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.MSIXPackageList"] + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.MSIXPackageList"]: """List MSIX packages in hostpool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -336,44 +536,45 @@ def list( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either MSIXPackageList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.MSIXPackageList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.MSIXPackageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('MSIXPackageList', pipeline_response) + deserialized = self._deserialize("MSIXPackageList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -382,7 +583,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -391,7 +596,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py index 0438e92acc25..d4f68bde7aca 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.DesktopVirtualization/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -30,7 +58,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,47 +73,50 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + **kwargs: Any + ) -> Iterable["_models.ResourceProviderOperationList"]: """List all of the available operations the Desktop Virtualization resource provider supports. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ResourceProviderOperationList] + :return: An iterator like instance of either ResourceProviderOperationList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + 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('ResourceProviderOperationList', pipeline_response) + deserialized = self._deserialize("ResourceProviderOperationList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,7 +125,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -103,7 +138,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.DesktopVirtualization/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.DesktopVirtualization/operations"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py index cdb369a42e1e..67d967ceaa77 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,341 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_host_pool_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_host_pool_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_by_host_pool_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_by_host_pool_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class PrivateEndpointConnectionsOperations(object): """PrivateEndpointConnectionsOperations operations. @@ -30,7 +349,7 @@ class PrivateEndpointConnectionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +364,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_host_pool( self, - resource_group_name, # type: str - host_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResultWithSystemData"] + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResultWithSystemData"]: """List private endpoint connections associated with hostpool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -59,45 +378,48 @@ def list_by_host_pool( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionListResultWithSystemData] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +428,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,19 +441,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections"} # type: ignore + @distributed_trace def get_by_host_pool( self, - resource_group_name, # type: str - host_pool_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": """Get a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -139,7 +466,7 @@ def get_by_host_pool( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -147,29 +474,26 @@ def get_by_host_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -182,16 +506,18 @@ def get_by_host_pool( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - def delete_by_host_pool( + get_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def delete_by_host_pool( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - host_pool_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Remove a connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -211,29 +537,26 @@ def delete_by_host_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.delete_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -243,17 +566,18 @@ def delete_by_host_pool( if cls: return cls(pipeline_response, None, {}) - delete_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace def update_by_host_pool( self, - resource_group_name, # type: str - host_pool_name, # type: str - private_endpoint_connection_name, # type: str - connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": """Approve or reject a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -264,10 +588,10 @@ def update_by_host_pool( with the Azure resource. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. - :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -275,34 +599,30 @@ def update_by_host_pool( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connection, 'PrivateEndpointConnection') + + request = build_update_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -315,15 +635,17 @@ def update_by_host_pool( return cls(pipeline_response, deserialized, {}) return deserialized - update_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + update_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResultWithSystemData"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateEndpointConnectionListResultWithSystemData"]: """List private endpoint connections. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -331,45 +653,48 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData + or the result of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionListResultWithSystemData] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + deserialized = self._deserialize("PrivateEndpointConnectionListResultWithSystemData", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -378,7 +703,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -387,19 +716,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore + list_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections"} # type: ignore + @distributed_trace def get_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": """Get a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -411,7 +741,7 @@ def get_by_workspace( :type private_endpoint_connection_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -419,29 +749,26 @@ def get_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.get_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -454,16 +781,18 @@ def get_by_workspace( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore - def delete_by_workspace( + get_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + + @distributed_trace + def delete_by_workspace( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: """Remove a connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -483,29 +812,26 @@ def delete_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + template_url=self.delete_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -515,17 +841,18 @@ def delete_by_workspace( if cls: return cls(pipeline_response, None, {}) - delete_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + delete_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + + @distributed_trace def update_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - private_endpoint_connection_name, # type: str - connection, # type: "_models.PrivateEndpointConnection" - **kwargs # type: Any - ): - # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": """Approve or reject a private endpoint connection. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -536,10 +863,10 @@ def update_by_workspace( with the Azure resource. :type private_endpoint_connection_name: str :param connection: Object containing the updated connection. - :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :type connection: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection :keyword callable cls: A custom type or function that will be passed the direct response :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :rtype: ~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnectionWithSystemData :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] @@ -547,34 +874,30 @@ def update_by_workspace( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(connection, 'PrivateEndpointConnection') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(connection, 'PrivateEndpointConnection') + + request = build_update_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -587,4 +910,6 @@ def update_by_workspace( return cls(pipeline_response, deserialized, {}) return deserialized - update_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + update_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore + diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py index 21893ee73489..bd26a3613b29 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,96 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_host_pool_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_workspace_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class PrivateLinkResourcesOperations(object): """PrivateLinkResourcesOperations operations. @@ -30,7 +104,7 @@ class PrivateLinkResourcesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +119,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_host_pool( self, - resource_group_name, # type: str - host_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """List the private link resources available for this hostpool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -59,45 +133,48 @@ def list_by_host_pool( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +183,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,18 +196,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources"} # type: ignore + @distributed_trace def list_by_workspace( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> Iterable["_models.PrivateLinkResourceListResult"]: """List the private link resources available for this workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -134,45 +216,48 @@ def list_by_workspace( :param workspace_name: The name of the workspace. :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.PrivateLinkResourceListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_workspace.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.list_by_workspace.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_workspace_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=next_link, + ) + 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('PrivateLinkResourceListResult', pipeline_response) + deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -181,7 +266,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -190,7 +279,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources'} # type: ignore + list_by_workspace.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py index d612336eff64..447bb530835f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,287 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + scaling_plan_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + scaling_plan_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + scaling_plan_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + scaling_plan_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "scalingPlanName": _SERIALIZER.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_host_pool_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ScalingPlansOperations(object): """ScalingPlansOperations operations. @@ -30,7 +295,7 @@ class ScalingPlansOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +310,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - scaling_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ScalingPlan" + resource_group_name: str, + scaling_plan_name: str, + **kwargs: Any + ) -> "_models.ScalingPlan": """Get a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +325,7 @@ def get( :type scaling_plan_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] @@ -68,28 +333,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,16 +364,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + + @distributed_trace def create( self, - resource_group_name, # type: str - scaling_plan_name, # type: str - scaling_plan, # type: "_models.ScalingPlan" - **kwargs # type: Any - ): - # type: (...) -> "_models.ScalingPlan" + resource_group_name: str, + scaling_plan_name: str, + scaling_plan: "_models.ScalingPlan", + **kwargs: Any + ) -> "_models.ScalingPlan": """Create or update a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -119,10 +383,10 @@ def create( :param scaling_plan_name: The name of the scaling plan. :type scaling_plan_name: str :param scaling_plan: Object containing scaling plan definitions. - :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlan + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] @@ -130,33 +394,29 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(scaling_plan, 'ScalingPlan') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(scaling_plan, 'ScalingPlan') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -173,15 +433,17 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized - create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore - def delete( + create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - scaling_plan_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + scaling_plan_name: str, + **kwargs: Any + ) -> None: """Remove a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -198,28 +460,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -229,27 +488,28 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - scaling_plan_name, # type: str - scaling_plan=None, # type: Optional["_models.ScalingPlanPatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ScalingPlan" + resource_group_name: str, + scaling_plan_name: str, + scaling_plan: Optional["_models.ScalingPlanPatch"] = None, + **kwargs: Any + ) -> "_models.ScalingPlan": """Update a scaling plan. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param scaling_plan_name: The name of the scaling plan. :type scaling_plan_name: str - :param scaling_plan: Object containing scaling plan definitions. - :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlanPatch + :param scaling_plan: Object containing scaling plan definitions. Default value is None. + :type scaling_plan: ~azure.mgmt.desktopvirtualization.models.ScalingPlanPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: ScalingPlan, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :rtype: ~azure.mgmt.desktopvirtualization.models.ScalingPlan :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] @@ -257,36 +517,32 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if scaling_plan is not None: - body_content = self._serialize.body(scaling_plan, 'ScalingPlanPatch') + _json = self._serialize.body(scaling_plan, 'ScalingPlanPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + scaling_plan_name=scaling_plan_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -299,57 +555,59 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScalingPlanList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ScalingPlanList"]: """List scaling plans. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('ScalingPlanList', pipeline_response) + deserialized = self._deserialize("ScalingPlanList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -358,7 +616,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -367,56 +629,56 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans"} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScalingPlanList"] + **kwargs: Any + ) -> Iterable["_models.ScalingPlanList"]: """List scaling plans in subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('ScalingPlanList', pipeline_response) + deserialized = self._deserialize("ScalingPlanList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,7 +687,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,18 +700,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans"} # type: ignore + @distributed_trace def list_by_host_pool( self, - resource_group_name, # type: str - host_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ScalingPlanList"] + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.ScalingPlanList"]: """List scaling plan associated with hostpool. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -454,44 +721,45 @@ def list_by_host_pool( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ScalingPlanList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ScalingPlanList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('ScalingPlanList', pipeline_response) + deserialized = self._deserialize("ScalingPlanList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -500,7 +768,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -509,7 +781,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py index 2480b7d82744..9157316cf88d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,190 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + *, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + _query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + *, + json: JSONType = None, + content: Any = None, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + _query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class SessionHostsOperations(object): """SessionHostsOperations operations. @@ -30,7 +198,7 @@ class SessionHostsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +213,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SessionHost" + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + **kwargs: Any + ) -> "_models.SessionHost": """Get a session host. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -63,7 +231,7 @@ def get( :type session_host_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.SessionHost + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] @@ -71,29 +239,26 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,17 +271,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore - def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - force=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: """Remove a SessionHost. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -125,7 +292,8 @@ def delete( :type host_pool_name: str :param session_host_name: The name of the session host within the specified host pool. :type session_host_name: str - :param force: Force flag to force sessionHost deletion even when userSession exists. + :param force: Force flag to force sessionHost deletion even when userSession exists. Default + value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -137,31 +305,27 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -171,18 +335,19 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}"} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - force=None, # type: Optional[bool] - session_host=None, # type: Optional["_models.SessionHostPatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.SessionHost" + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + force: Optional[bool] = None, + session_host: Optional["_models.SessionHostPatch"] = None, + **kwargs: Any + ) -> "_models.SessionHost": """Update a session host. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -191,13 +356,14 @@ def update( :type host_pool_name: str :param session_host_name: The name of the session host within the specified host pool. :type session_host_name: str - :param force: Force flag to update assign, unassign or reassign personal desktop. + :param force: Force flag to update assign, unassign or reassign personal desktop. Default value + is None. :type force: bool - :param session_host: Object containing SessionHost definitions. - :type session_host: ~desktop_virtualization_api_client.models.SessionHostPatch + :param session_host: Object containing SessionHost definitions. Default value is None. + :type session_host: ~azure.mgmt.desktopvirtualization.models.SessionHostPatch :keyword callable cls: A custom type or function that will be passed the direct response :return: SessionHost, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.SessionHost + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHost :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] @@ -205,39 +371,34 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if session_host is not None: - body_content = self._serialize.body(session_host, 'SessionHostPatch') + _json = self._serialize.body(session_host, 'SessionHostPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + content_type=content_type, + json=_json, + force=force, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -250,15 +411,17 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}"} # type: ignore + + + @distributed_trace def list( self, - resource_group_name, # type: str - host_pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SessionHostList"] + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> Iterable["_models.SessionHostList"]: """List sessionHosts. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -267,44 +430,45 @@ def list( :type host_pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either SessionHostList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.SessionHostList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHostList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + template_url=next_link, + ) + 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('SessionHostList', pipeline_response) + deserialized = self._deserialize("SessionHostList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -313,7 +477,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -322,7 +490,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py index 6252ac496e01..0e090ef963b7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,60 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +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( + subscription_id: str, + resource_group_name: str, + application_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "applicationGroupName": _SERIALIZER.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class StartMenuItemsOperations(object): """StartMenuItemsOperations operations. @@ -30,7 +68,7 @@ class StartMenuItemsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +83,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - application_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.StartMenuItemList"] + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> Iterable["_models.StartMenuItemList"]: """List start menu items in the given application group. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,44 +98,46 @@ def list( :type application_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either StartMenuItemList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.StartMenuItemList] + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.StartMenuItemList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.StartMenuItemList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + application_group_name=application_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('StartMenuItemList', pipeline_response) + deserialized = self._deserialize("StartMenuItemList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,7 +146,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -115,7 +159,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems"} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py index 8d2bd84f3da7..e4f2f5a0a014 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,275 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_host_pool_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + *, + force: Optional[bool] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if force is not None: + _query_parameters['force'] = _SERIALIZER.query("force", force, 'bool') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_disconnect_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_send_message_request( + subscription_id: str, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "hostPoolName": _SERIALIZER.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + "sessionHostName": _SERIALIZER.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + "userSessionId": _SERIALIZER.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class UserSessionsOperations(object): """UserSessionsOperations operations. @@ -30,7 +283,7 @@ class UserSessionsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,14 +298,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_host_pool( self, - resource_group_name, # type: str - host_pool_name, # type: str - filter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserSessionList"] + resource_group_name: str, + host_pool_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.UserSessionList"]: """List userSessions. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,50 +313,51 @@ def list_by_host_pool( :param host_pool_name: The name of the host pool within the specified resource group. :type host_pool_name: str :param filter: OData filter expression. Valid properties for filtering are userprincipalname - and sessionstate. + and sessionstate. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSessionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.UserSessionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_host_pool.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + filter=filter, + template_url=self.list_by_host_pool.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_host_pool_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + 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('UserSessionList', pipeline_response) + deserialized = self._deserialize("UserSessionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,7 +366,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -121,20 +379,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions'} # type: ignore + list_by_host_pool.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - user_session_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.UserSession" + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs: Any + ) -> "_models.UserSession": """Get a userSession. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -147,7 +406,7 @@ def get( :type user_session_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: UserSession, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.UserSession + :rtype: ~azure.mgmt.desktopvirtualization.models.UserSession :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSession"] @@ -155,30 +414,27 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -191,18 +447,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore - def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - user_session_id, # type: str - force=None, # type: Optional[bool] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: """Remove a userSession. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -213,7 +471,7 @@ def delete( :type session_host_name: str :param user_session_id: The name of the user session within the specified session host. :type user_session_id: str - :param force: Force flag to login off userSession. + :param force: Force flag to login off userSession. Default value is None. :type force: bool :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -225,32 +483,28 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if force is not None: - query_parameters['force'] = self._serialize.query("force", force, 'bool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + force=force, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -260,16 +514,17 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.UserSessionList"] + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + **kwargs: Any + ) -> Iterable["_models.UserSessionList"]: """List userSessions. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -280,45 +535,47 @@ def list( :type session_host_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either UserSessionList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.UserSessionList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + api_version=api_version, + template_url=next_link, + ) + 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('UserSessionList', pipeline_response) + deserialized = self._deserialize("UserSessionList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -327,7 +584,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -336,20 +597,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions"} # type: ignore - def disconnect( + @distributed_trace + def disconnect( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - user_session_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs: Any + ) -> None: """Disconnect a userSession. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -370,30 +632,27 @@ def disconnect( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.disconnect.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + + request = build_disconnect_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + template_url=self.disconnect.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -403,18 +662,19 @@ def disconnect( if cls: return cls(pipeline_response, None, {}) - disconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect'} # type: ignore + disconnect.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect"} # type: ignore + - def send_message( + @distributed_trace + def send_message( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - host_pool_name, # type: str - session_host_name, # type: str - user_session_id, # type: str - send_message=None, # type: Optional["_models.SendMessage"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + send_message: Optional["_models.SendMessage"] = None, + **kwargs: Any + ) -> None: """Send a message to a user. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -425,8 +685,9 @@ def send_message( :type session_host_name: str :param user_session_id: The name of the user session within the specified session host. :type user_session_id: str - :param send_message: Object containing message includes title and message body. - :type send_message: ~desktop_virtualization_api_client.models.SendMessage + :param send_message: Object containing message includes title and message body. Default value + is None. + :type send_message: ~azure.mgmt.desktopvirtualization.models.SendMessage :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) :rtype: None @@ -437,38 +698,34 @@ def send_message( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.send_message.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), - 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), - 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if send_message is not None: - body_content = self._serialize.body(send_message, 'SendMessage') + _json = self._serialize.body(send_message, 'SendMessage') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_send_message_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + user_session_id=user_session_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.send_message.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -478,4 +735,5 @@ def send_message( if cls: return cls(pipeline_response, None, {}) - send_message.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage'} # type: ignore + send_message.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage"} # type: ignore + diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py index 909e892418f0..766fd402fc3b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,251 @@ # 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 TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + workspace_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "workspaceName": _SERIALIZER.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class WorkspacesOperations(object): """WorkspacesOperations operations. @@ -30,7 +259,7 @@ class WorkspacesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~desktop_virtualization_api_client.models + :type models: ~azure.mgmt.desktopvirtualization.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,13 +274,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.Workspace": """Get a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -60,7 +289,7 @@ def get( :type workspace_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Workspace + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] @@ -68,28 +297,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,16 +328,18 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace, # type: "_models.Workspace" - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + workspace: "_models.Workspace", + **kwargs: Any + ) -> "_models.Workspace": """Create or update a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -119,10 +347,10 @@ def create_or_update( :param workspace_name: The name of the workspace. :type workspace_name: str :param workspace: Object containing Workspace definitions. - :type workspace: ~desktop_virtualization_api_client.models.Workspace + :type workspace: ~azure.mgmt.desktopvirtualization.models.Workspace :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Workspace + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] @@ -130,33 +358,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(workspace, 'Workspace') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(workspace, 'Workspace') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -173,15 +397,17 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore - def delete( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - workspace_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: """Remove a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. @@ -198,28 +424,25 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -229,27 +452,28 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - workspace_name, # type: str - workspace=None, # type: Optional["_models.WorkspacePatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.Workspace" + resource_group_name: str, + workspace_name: str, + workspace: Optional["_models.WorkspacePatch"] = None, + **kwargs: Any + ) -> "_models.Workspace": """Update a workspace. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :param workspace_name: The name of the workspace. :type workspace_name: str - :param workspace: Object containing Workspace definitions. - :type workspace: ~desktop_virtualization_api_client.models.WorkspacePatch + :param workspace: Object containing Workspace definitions. Default value is None. + :type workspace: ~azure.mgmt.desktopvirtualization.models.WorkspacePatch :keyword callable cls: A custom type or function that will be passed the direct response :return: Workspace, or the result of cls(response) - :rtype: ~desktop_virtualization_api_client.models.Workspace + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] @@ -257,36 +481,32 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if workspace is not None: - body_content = self._serialize.body(workspace, 'WorkspacePatch') + _json = self._serialize.body(workspace, 'WorkspacePatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + workspace_name=workspace_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -299,57 +519,59 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}"} # type: ignore + + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.WorkspaceList"]: """List workspaces. :param resource_group_name: The name of the resource group. The name is case insensitive. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.WorkspaceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + 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('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -358,7 +580,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -367,56 +593,56 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces"} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.WorkspaceList"] + **kwargs: Any + ) -> Iterable["_models.WorkspaceList"]: """List workspaces in subscription. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkspaceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.WorkspaceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2022-02-10-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-03-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + 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('WorkspaceList', pipeline_response) + deserialized = self._deserialize("WorkspaceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -425,7 +651,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -434,7 +664,8 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) - list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces"} # type: ignore