diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json index e7cc76c50156..d0989f125bc7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json @@ -1,11 +1,11 @@ { - "commit": "f1e65f90e77a72258801439e757fc76ecb13a7fc", + "commit": "849d229ed0ac9d7bbef13a25884f0b03f176514d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --tag=package-2024-04 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/desktopvirtualization/resource-manager/readme.md" } \ No newline at end of file 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 835e232059af..cba57968cc63 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py @@ -28,13 +28,13 @@ class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-08-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-03") + api_version: str = kwargs.pop("api_version", "2024-04-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py index 0205fa978041..b73ef743d966 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_mgmt_client.py @@ -19,12 +19,15 @@ from ._configuration import DesktopVirtualizationMgmtClientConfiguration from ._serialization import Deserializer, Serializer from .operations import ( + ActiveSessionHostConfigurationsOperations, AppAttachPackageInfoOperations, AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -33,6 +36,10 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperations, + SessionHostManagementsUpdateStatusOperations, + SessionHostOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -76,10 +83,31 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype desktops: azure.mgmt.desktopvirtualization.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations :vartype host_pools: azure.mgmt.desktopvirtualization.operations.HostPoolsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.operations.InitiateSessionHostUpdateOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.operations.ControlSessionHostUpdateOperations + :ivar session_host_managements_update_status: SessionHostManagementsUpdateStatusOperations + operations + :vartype session_host_managements_update_status: + azure.mgmt.desktopvirtualization.operations.SessionHostManagementsUpdateStatusOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.operations.SessionHostConfigurationsOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.operations.ActiveSessionHostConfigurationsOperations :ivar user_sessions: UserSessionsOperations operations :vartype user_sessions: azure.mgmt.desktopvirtualization.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations :vartype session_hosts: azure.mgmt.desktopvirtualization.operations.SessionHostsOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.operations.SessionHostOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.operations.MSIXPackagesOperations :ivar app_attach_package_info: AppAttachPackageInfoOperations operations @@ -96,9 +124,11 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-08-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( @@ -157,8 +187,27 @@ def __init__( 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.session_host_managements = SessionHostManagementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_update_status = SessionHostManagementsUpdateStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations = SessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + 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.session_host = SessionHostOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.app_attach_package_info = AppAttachPackageInfoOperations( self._client, self._config, self._serialize, self._deserialize diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" 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 50ef97143926..865ea5d9818a 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 @@ -28,13 +28,13 @@ class DesktopVirtualizationMgmtClientConfiguration: # pylint: disable=too-many- :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-08-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str """ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-03") + api_version: str = kwargs.pop("api_version", "2024-04-08-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py index 459f270b399e..6b8ef7140772 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_mgmt_client.py @@ -19,12 +19,15 @@ from .._serialization import Deserializer, Serializer from ._configuration import DesktopVirtualizationMgmtClientConfiguration from .operations import ( + ActiveSessionHostConfigurationsOperations, AppAttachPackageInfoOperations, AppAttachPackageOperations, ApplicationGroupsOperations, ApplicationsOperations, + ControlSessionHostUpdateOperations, DesktopsOperations, HostPoolsOperations, + InitiateSessionHostUpdateOperations, MSIXPackagesOperations, MsixImagesOperations, Operations, @@ -33,6 +36,10 @@ ScalingPlanPersonalSchedulesOperations, ScalingPlanPooledSchedulesOperations, ScalingPlansOperations, + SessionHostConfigurationsOperations, + SessionHostManagementsOperations, + SessionHostManagementsUpdateStatusOperations, + SessionHostOperations, SessionHostsOperations, StartMenuItemsOperations, UserSessionsOperations, @@ -77,10 +84,31 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :vartype desktops: azure.mgmt.desktopvirtualization.aio.operations.DesktopsOperations :ivar host_pools: HostPoolsOperations operations :vartype host_pools: azure.mgmt.desktopvirtualization.aio.operations.HostPoolsOperations + :ivar session_host_managements: SessionHostManagementsOperations operations + :vartype session_host_managements: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsOperations + :ivar initiate_session_host_update: InitiateSessionHostUpdateOperations operations + :vartype initiate_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.InitiateSessionHostUpdateOperations + :ivar control_session_host_update: ControlSessionHostUpdateOperations operations + :vartype control_session_host_update: + azure.mgmt.desktopvirtualization.aio.operations.ControlSessionHostUpdateOperations + :ivar session_host_managements_update_status: SessionHostManagementsUpdateStatusOperations + operations + :vartype session_host_managements_update_status: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostManagementsUpdateStatusOperations + :ivar session_host_configurations: SessionHostConfigurationsOperations operations + :vartype session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.SessionHostConfigurationsOperations + :ivar active_session_host_configurations: ActiveSessionHostConfigurationsOperations operations + :vartype active_session_host_configurations: + azure.mgmt.desktopvirtualization.aio.operations.ActiveSessionHostConfigurationsOperations :ivar user_sessions: UserSessionsOperations operations :vartype user_sessions: azure.mgmt.desktopvirtualization.aio.operations.UserSessionsOperations :ivar session_hosts: SessionHostsOperations operations :vartype session_hosts: azure.mgmt.desktopvirtualization.aio.operations.SessionHostsOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.aio.operations.SessionHostOperations :ivar msix_packages: MSIXPackagesOperations operations :vartype msix_packages: azure.mgmt.desktopvirtualization.aio.operations.MSIXPackagesOperations :ivar app_attach_package_info: AppAttachPackageInfoOperations operations @@ -97,9 +125,11 @@ class DesktopVirtualizationMgmtClient: # pylint: disable=client-accepts-api-ver :type subscription_id: str :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-03". Note that overriding this - default value may result in unsupported behavior. + :keyword api_version: Api Version. Default value is "2024-04-08-preview". Note that overriding + this default value may result in unsupported behavior. :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( @@ -158,8 +188,27 @@ def __init__( 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.session_host_managements = SessionHostManagementsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.initiate_session_host_update = InitiateSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.control_session_host_update = ControlSessionHostUpdateOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_managements_update_status = SessionHostManagementsUpdateStatusOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.session_host_configurations = SessionHostConfigurationsOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.active_session_host_configurations = ActiveSessionHostConfigurationsOperations( + 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.session_host = SessionHostOperations(self._client, self._config, self._serialize, self._deserialize) self.msix_packages = MSIXPackagesOperations(self._client, self._config, self._serialize, self._deserialize) self.app_attach_package_info = AppAttachPackageInfoOperations( self._client, self._config, self._serialize, self._deserialize diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py index df927dd95440..8ea21f89ab23 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py @@ -18,8 +18,15 @@ from ._applications_operations import ApplicationsOperations from ._desktops_operations import DesktopsOperations from ._host_pools_operations import HostPoolsOperations +from ._session_host_managements_operations import SessionHostManagementsOperations +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations +from ._session_host_managements_update_status_operations import SessionHostManagementsUpdateStatusOperations +from ._session_host_configurations_operations import SessionHostConfigurationsOperations +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations +from ._session_host_operations import SessionHostOperations from ._msix_packages_operations import MSIXPackagesOperations from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations @@ -42,8 +49,15 @@ "ApplicationsOperations", "DesktopsOperations", "HostPoolsOperations", + "SessionHostManagementsOperations", + "InitiateSessionHostUpdateOperations", + "ControlSessionHostUpdateOperations", + "SessionHostManagementsUpdateStatusOperations", + "SessionHostConfigurationsOperations", + "ActiveSessionHostConfigurationsOperations", "UserSessionsOperations", "SessionHostsOperations", + "SessionHostOperations", "MSIXPackagesOperations", "AppAttachPackageInfoOperations", "MsixImagesOperations", diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..d86a8a3708b1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,203 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._active_session_host_configurations_operations import ( + build_get_request, + build_list_by_host_pool_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ActiveSessionHostConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`active_session_host_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update + operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: ActiveSessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActiveSessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ActiveSessionHostConfiguration"]: + """List activeSessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either ActiveSessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActiveSessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ActiveSessionHostConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py index e15d1700b12f..3560a484016e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_app_attach_package_operations.py @@ -73,7 +73,7 @@ async def get( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :return: AppAttachPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage @@ -137,7 +137,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package: Object containing App Attach Package definitions. Required. :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage @@ -164,7 +164,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package: Object containing App Attach Package definitions. Required. :type app_attach_package: IO[bytes] @@ -189,7 +189,7 @@ async def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package: Object containing App Attach Package definitions. Is either a AppAttachPackage type or a IO[bytes] type. Required. @@ -256,15 +256,17 @@ async def create_or_update( @distributed_trace_async async def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any + self, resource_group_name: str, app_attach_package_name: str, force: Optional[bool] = None, **kwargs: Any ) -> None: """Remove an App Attach Package. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str + :param force: Force flag to delete App Attach package. Default value is None. + :type force: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -287,6 +289,7 @@ async def delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, app_attach_package_name=app_attach_package_name, subscription_id=self._config.subscription_id, + force=force, api_version=api_version, headers=_headers, params=_params, @@ -323,7 +326,7 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package_patch: Object containing App Attach Package definition. Default value is None. @@ -351,7 +354,7 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package_patch: Object containing App Attach Package definition. Default value is None. @@ -377,7 +380,7 @@ async def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package_patch: Object containing App Attach Package definition. Is either a AppAttachPackagePatch type or a IO[bytes] type. Default value is None. @@ -454,8 +457,8 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param filter: OData filter expression. Valid properties for filtering are package name and - host pool. Default value is None. + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, package owner name, and custom data. Default value is None. :type filter: str :return: An iterator like instance of either AppAttachPackage or the result of cls(response) :rtype: @@ -537,8 +540,8 @@ def list_by_subscription( ) -> AsyncIterable["_models.AppAttachPackage"]: """List App Attach packages in subscription. - :param filter: OData filter expression. Valid properties for filtering are package name, host - pool, and resource group. Default value is None. + :param filter: OData filter expression. Valid properties for filtering are package name, + resource group, host pool, package owner name, and custom data. Default value is None. :type filter: str :return: An iterator like instance of either AppAttachPackage or the result of cls(response) :rtype: diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py new file mode 100644 index 000000000000..45d92ea1e068 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_control_session_host_update_operations.py @@ -0,0 +1,255 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._control_session_host_update_operations import build_post_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class ControlSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`control_session_host_update` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _post_initial( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(host_pool_update_control_parameter, (IOBase, bytes)): + _content = host_pool_update_control_parameter + else: + _json = self._serialize.body(host_pool_update_control_parameter, "HostPoolUpdateControlParameter") + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: _models.HostPoolUpdateControlParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Is either a HostPoolUpdateControlParameter type or a IO[bytes] type. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter or IO[bytes] + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._post_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + host_pool_update_control_parameter=host_pool_update_control_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..9894f5285813 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,190 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._initiate_session_host_update_operations import build_post_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class InitiateSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`initiate_session_host_update` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + async def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[_models.UpdateSessionHostsRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Is either a UpdateSessionHostsRequestBody type or a + IO[bytes] type. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_session_hosts_request_body, (IOBase, bytes)): + _content = update_session_hosts_request_body + else: + if update_session_hosts_request_body is not None: + _json = self._serialize.body(update_session_hosts_request_body, "UpdateSessionHostsRequestBody") + else: + _json = None + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py new file mode 100644 index 000000000000..a56176d53240 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_configurations_operations.py @@ -0,0 +1,647 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ...operations._session_host_configurations_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_host_pool_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + async def _create_or_update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + _json = self._serialize.body(session_host_configuration, "SessionHostConfiguration") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: _models.SessionHostConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfiguration type or a IO[bytes] type. Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, + AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + if session_host_configuration is not None: + _json = self._serialize.body(session_host_configuration, "SessionHostConfigurationPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[_models.SessionHostConfigurationPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> AsyncLROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfigurationPatch type or a IO[bytes] type. Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch or IO[bytes] + :return: An instance of AsyncLROPoller that returns either SessionHostConfiguration or the + result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace_async + async def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.SessionHostConfiguration: + """Get a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SessionHostConfiguration"]: + """List sessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py new file mode 100644 index 000000000000..df540f9b35c1 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_operations.py @@ -0,0 +1,471 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._session_host_managements_operations import ( + build_create_or_update_request, + build_get_request, + build_list_by_host_pool_request, + build_update_request, +) + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostManagementsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.SessionHostManagement: + """Get a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: _models.SessionHostManagement, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Union[_models.SessionHostManagement, IO[bytes]], + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagement type or a IO[bytes] type. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + _json = self._serialize.body(session_host_management, "SessionHostManagement") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[_models.SessionHostManagementPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[Union[_models.SessionHostManagementPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagementPatch type or a IO[bytes] type. Default value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + if session_host_management is not None: + _json = self._serialize.body(session_host_management, "SessionHostManagementPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> AsyncIterable["_models.SessionHostManagement"]: + """List SessionHostManagements by hostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostManagement or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagementList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostManagementList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.py new file mode 100644 index 000000000000..a2782f0294bc --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_managements_update_status_operations.py @@ -0,0 +1,112 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._session_host_managements_update_status_operations import build_get_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostManagementsUpdateStatusOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements_update_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.SessionHostManagementUpdateStatus: + """Get the session host update status for a given hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagementUpdateStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagementUpdateStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagementUpdateStatus] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagementUpdateStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py new file mode 100644 index 000000000000..8d16da088de0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_host_operations.py @@ -0,0 +1,111 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ...operations._session_host_operations import build_retry_provisioning_request + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + + +class SessionHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.aio.DesktopVirtualizationMgmtClient`'s + :attr:`session_host` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def retry_provisioning( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> None: + """Retry provisioning on a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_retry_provisioning_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # 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 55d5d6e8fbf5..4885c96f5c53 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 @@ -356,6 +356,7 @@ def list( page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, + vm_path: Optional[str] = None, **kwargs: Any ) -> AsyncIterable["_models.SessionHost"]: """List sessionHosts. @@ -371,6 +372,8 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int + :param vm_path: The path to the VM. Default value is None. + :type vm_path: str :return: An iterator like instance of either SessionHost or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHost] @@ -400,6 +403,7 @@ def prepare_request(next_link=None): page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, + vm_path=vm_path, api_version=api_version, headers=_headers, params=_params, 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 e4e4586e68ad..92c98f2040f0 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,6 +6,10 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +from ._models_py3 import ActiveDirectoryInfoPatchProperties +from ._models_py3 import ActiveDirectoryInfoProperties +from ._models_py3 import ActiveSessionHostConfiguration +from ._models_py3 import ActiveSessionHostConfigurationList from ._models_py3 import AgentUpdatePatchProperties from ._models_py3 import AgentUpdateProperties from ._models_py3 import AppAttachPackage @@ -20,10 +24,19 @@ from ._models_py3 import ApplicationGroupPatch from ._models_py3 import ApplicationList from ._models_py3 import ApplicationPatch +from ._models_py3 import AzureActiveDirectoryInfoProperties +from ._models_py3 import BootDiagnosticsInfoPatchProperties +from ._models_py3 import BootDiagnosticsInfoProperties from ._models_py3 import CloudErrorProperties +from ._models_py3 import CustomInfoPatchProperties +from ._models_py3 import CustomInfoProperties from ._models_py3 import Desktop from ._models_py3 import DesktopList from ._models_py3 import DesktopPatch +from ._models_py3 import DiskInfoPatchProperties +from ._models_py3 import DiskInfoProperties +from ._models_py3 import DomainInfoPatchProperties +from ._models_py3 import DomainInfoProperties from ._models_py3 import ErrorAdditionalInfo from ._models_py3 import ErrorDetail from ._models_py3 import ErrorResponse @@ -32,8 +45,15 @@ from ._models_py3 import HostPool from ._models_py3 import HostPoolList from ._models_py3 import HostPoolPatch -from ._models_py3 import Identity +from ._models_py3 import HostPoolUpdateConfigurationPatchProperties +from ._models_py3 import HostPoolUpdateConfigurationProperties +from ._models_py3 import HostPoolUpdateControlParameter +from ._models_py3 import HostPoolUpdateFault +from ._models_py3 import ImageInfoPatchProperties +from ._models_py3 import ImageInfoProperties from ._models_py3 import ImportPackageInfoRequest +from ._models_py3 import KeyVaultCredentialsPatchProperties +from ._models_py3 import KeyVaultCredentialsProperties from ._models_py3 import LogSpecification from ._models_py3 import MSIXImageURI from ._models_py3 import MSIXPackage @@ -41,8 +61,13 @@ from ._models_py3 import MSIXPackagePatch from ._models_py3 import MaintenanceWindowPatchProperties from ._models_py3 import MaintenanceWindowProperties +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import MarketplaceInfoPatchProperties +from ._models_py3 import MarketplaceInfoProperties from ._models_py3 import MsixPackageApplications from ._models_py3 import MsixPackageDependencies +from ._models_py3 import NetworkInfoPatchProperties +from ._models_py3 import NetworkInfoProperties from ._models_py3 import OperationProperties from ._models_py3 import Plan from ._models_py3 import PrivateEndpoint @@ -59,9 +84,6 @@ from ._models_py3 import RegistrationTokenMinimal 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 @@ -76,12 +98,24 @@ from ._models_py3 import ScalingPlanPooledScheduleList from ._models_py3 import ScalingPlanPooledSchedulePatch from ._models_py3 import ScalingSchedule +from ._models_py3 import SecurityInfoPatchProperties +from ._models_py3 import SecurityInfoProperties from ._models_py3 import SendMessage from ._models_py3 import ServiceSpecification from ._models_py3 import SessionHost +from ._models_py3 import SessionHostConfiguration +from ._models_py3 import SessionHostConfigurationList +from ._models_py3 import SessionHostConfigurationOperationStatus +from ._models_py3 import SessionHostConfigurationOperationStatusList +from ._models_py3 import SessionHostConfigurationPatch from ._models_py3 import SessionHostHealthCheckFailureDetails from ._models_py3 import SessionHostHealthCheckReport from ._models_py3 import SessionHostList +from ._models_py3 import SessionHostManagement +from ._models_py3 import SessionHostManagementList +from ._models_py3 import SessionHostManagementOperationProgress +from ._models_py3 import SessionHostManagementPatch +from ._models_py3 import SessionHostManagementUpdateStatus from ._models_py3 import SessionHostPatch from ._models_py3 import Sku from ._models_py3 import StartMenuItem @@ -89,6 +123,8 @@ from ._models_py3 import SystemData from ._models_py3 import Time from ._models_py3 import TrackedResource +from ._models_py3 import UpdateSessionHostsRequestBody +from ._models_py3 import UserAssignedIdentity from ._models_py3 import UserSession from ._models_py3 import UserSessionList from ._models_py3 import Workspace @@ -101,20 +137,31 @@ from ._desktop_virtualization_mgmt_client_enums import CommandLineSetting from ._desktop_virtualization_mgmt_client_enums import CreatedByType from ._desktop_virtualization_mgmt_client_enums import DayOfWeek +from ._desktop_virtualization_mgmt_client_enums import DirectUDP +from ._desktop_virtualization_mgmt_client_enums import DomainJoinType from ._desktop_virtualization_mgmt_client_enums import FailHealthCheckOnStagingFailure +from ._desktop_virtualization_mgmt_client_enums import FaultType from ._desktop_virtualization_mgmt_client_enums import HealthCheckName from ._desktop_virtualization_mgmt_client_enums import HealthCheckResult from ._desktop_virtualization_mgmt_client_enums import HostPoolType +from ._desktop_virtualization_mgmt_client_enums import HostPoolUpdateAction from ._desktop_virtualization_mgmt_client_enums import HostpoolPublicNetworkAccess from ._desktop_virtualization_mgmt_client_enums import LoadBalancerType +from ._desktop_virtualization_mgmt_client_enums import ManagedPrivateUDP +from ._desktop_virtualization_mgmt_client_enums import ManagedServiceIdentityType +from ._desktop_virtualization_mgmt_client_enums import ManagementType +from ._desktop_virtualization_mgmt_client_enums import OperationTypeSHM from ._desktop_virtualization_mgmt_client_enums import PackageTimestamped from ._desktop_virtualization_mgmt_client_enums import PersonalDesktopAssignmentType from ._desktop_virtualization_mgmt_client_enums import PreferredAppGroupType from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointConnectionProvisioningState from ._desktop_virtualization_mgmt_client_enums import PrivateEndpointServiceConnectionStatus from ._desktop_virtualization_mgmt_client_enums import ProvisioningState +from ._desktop_virtualization_mgmt_client_enums import ProvisioningStateSHC from ._desktop_virtualization_mgmt_client_enums import PublicNetworkAccess +from ._desktop_virtualization_mgmt_client_enums import PublicUDP from ._desktop_virtualization_mgmt_client_enums import RegistrationTokenOperation +from ._desktop_virtualization_mgmt_client_enums import RelayUDP from ._desktop_virtualization_mgmt_client_enums import RemoteApplicationType from ._desktop_virtualization_mgmt_client_enums import SSOSecretType from ._desktop_virtualization_mgmt_client_enums import ScalingHostPoolType @@ -128,12 +175,19 @@ from ._desktop_virtualization_mgmt_client_enums import StartupBehavior from ._desktop_virtualization_mgmt_client_enums import Status from ._desktop_virtualization_mgmt_client_enums import StopHostsWhen +from ._desktop_virtualization_mgmt_client_enums import Type from ._desktop_virtualization_mgmt_client_enums import UpdateState +from ._desktop_virtualization_mgmt_client_enums import VirtualMachineDiskType +from ._desktop_virtualization_mgmt_client_enums import VirtualMachineSecurityType from ._patch import __all__ as _patch_all from ._patch import * # pylint: disable=unused-wildcard-import from ._patch import patch_sdk as _patch_sdk __all__ = [ + "ActiveDirectoryInfoPatchProperties", + "ActiveDirectoryInfoProperties", + "ActiveSessionHostConfiguration", + "ActiveSessionHostConfigurationList", "AgentUpdatePatchProperties", "AgentUpdateProperties", "AppAttachPackage", @@ -148,10 +202,19 @@ "ApplicationGroupPatch", "ApplicationList", "ApplicationPatch", + "AzureActiveDirectoryInfoProperties", + "BootDiagnosticsInfoPatchProperties", + "BootDiagnosticsInfoProperties", "CloudErrorProperties", + "CustomInfoPatchProperties", + "CustomInfoProperties", "Desktop", "DesktopList", "DesktopPatch", + "DiskInfoPatchProperties", + "DiskInfoProperties", + "DomainInfoPatchProperties", + "DomainInfoProperties", "ErrorAdditionalInfo", "ErrorDetail", "ErrorResponse", @@ -160,8 +223,15 @@ "HostPool", "HostPoolList", "HostPoolPatch", - "Identity", + "HostPoolUpdateConfigurationPatchProperties", + "HostPoolUpdateConfigurationProperties", + "HostPoolUpdateControlParameter", + "HostPoolUpdateFault", + "ImageInfoPatchProperties", + "ImageInfoProperties", "ImportPackageInfoRequest", + "KeyVaultCredentialsPatchProperties", + "KeyVaultCredentialsProperties", "LogSpecification", "MSIXImageURI", "MSIXPackage", @@ -169,8 +239,13 @@ "MSIXPackagePatch", "MaintenanceWindowPatchProperties", "MaintenanceWindowProperties", + "ManagedServiceIdentity", + "MarketplaceInfoPatchProperties", + "MarketplaceInfoProperties", "MsixPackageApplications", "MsixPackageDependencies", + "NetworkInfoPatchProperties", + "NetworkInfoProperties", "OperationProperties", "Plan", "PrivateEndpoint", @@ -187,9 +262,6 @@ "RegistrationTokenMinimal", "Resource", "ResourceModelWithAllowedPropertySet", - "ResourceModelWithAllowedPropertySetIdentity", - "ResourceModelWithAllowedPropertySetPlan", - "ResourceModelWithAllowedPropertySetSku", "ResourceProviderOperation", "ResourceProviderOperationDisplay", "ResourceProviderOperationList", @@ -204,12 +276,24 @@ "ScalingPlanPooledScheduleList", "ScalingPlanPooledSchedulePatch", "ScalingSchedule", + "SecurityInfoPatchProperties", + "SecurityInfoProperties", "SendMessage", "ServiceSpecification", "SessionHost", + "SessionHostConfiguration", + "SessionHostConfigurationList", + "SessionHostConfigurationOperationStatus", + "SessionHostConfigurationOperationStatusList", + "SessionHostConfigurationPatch", "SessionHostHealthCheckFailureDetails", "SessionHostHealthCheckReport", "SessionHostList", + "SessionHostManagement", + "SessionHostManagementList", + "SessionHostManagementOperationProgress", + "SessionHostManagementPatch", + "SessionHostManagementUpdateStatus", "SessionHostPatch", "Sku", "StartMenuItem", @@ -217,6 +301,8 @@ "SystemData", "Time", "TrackedResource", + "UpdateSessionHostsRequestBody", + "UserAssignedIdentity", "UserSession", "UserSessionList", "Workspace", @@ -228,20 +314,31 @@ "CommandLineSetting", "CreatedByType", "DayOfWeek", + "DirectUDP", + "DomainJoinType", "FailHealthCheckOnStagingFailure", + "FaultType", "HealthCheckName", "HealthCheckResult", "HostPoolType", + "HostPoolUpdateAction", "HostpoolPublicNetworkAccess", "LoadBalancerType", + "ManagedPrivateUDP", + "ManagedServiceIdentityType", + "ManagementType", + "OperationTypeSHM", "PackageTimestamped", "PersonalDesktopAssignmentType", "PreferredAppGroupType", "PrivateEndpointConnectionProvisioningState", "PrivateEndpointServiceConnectionStatus", "ProvisioningState", + "ProvisioningStateSHC", "PublicNetworkAccess", + "PublicUDP", "RegistrationTokenOperation", + "RelayUDP", "RemoteApplicationType", "SSOSecretType", "ScalingHostPoolType", @@ -255,7 +352,10 @@ "StartupBehavior", "Status", "StopHostsWhen", + "Type", "UpdateState", + "VirtualMachineDiskType", + "VirtualMachineSecurityType", ] __all__.extend([p for p in _patch_all if p not in __all__]) _patch_sdk() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py index 81bb4af5b02b..c77efa726ee5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_mgmt_client_enums.py @@ -68,6 +68,27 @@ class DayOfWeek(str, Enum, metaclass=CaseInsensitiveEnumMeta): SUNDAY = "Sunday" +class DirectUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class DomainJoinType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of domain join done by the virtual machine.""" + + ACTIVE_DIRECTORY = "ActiveDirectory" + """Using microsoft active directory.""" + AZURE_ACTIVE_DIRECTORY = "AzureActiveDirectory" + """Using microsoft azure active directory.""" + + class FailHealthCheckOnStagingFailure(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Parameter indicating how the health check should behave if this package fails staging.""" @@ -76,6 +97,15 @@ class FailHealthCheckOnStagingFailure(str, Enum, metaclass=CaseInsensitiveEnumMe DO_NOT_FAIL = "DoNotFail" +class FaultType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Hostpool update fault type.""" + + SERVICE_ERROR = "ServiceError" + """Fault caused by service error.""" + USER_ERROR = "UserError" + """Fault caused by user error.""" + + class HealthCheckName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Represents the name of the health check operation performed.""" @@ -171,12 +201,67 @@ class HostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): PersonalDesktopAssignmentType must be Direct.""" +class HostPoolUpdateAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Action types for controlling hostpool update.""" + + START = "Start" + """Start the hostpool update.""" + PAUSE = "Pause" + """Pause the hostpool update.""" + CANCEL = "Cancel" + """Cancel the hostpool update.""" + RETRY = "Retry" + """Retry the hostpool update.""" + RESUME = "Resume" + """Resume the hostpool update.""" + + class LoadBalancerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the load balancer.""" BREADTH_FIRST = "BreadthFirst" DEPTH_FIRST = "DepthFirst" PERSISTENT = "Persistent" + MULTIPLE_PERSISTENT = "MultiplePersistent" + + +class ManagedPrivateUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + +class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + + +class ManagementType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of management for this hostpool, Automated or Standard. The default value is + Automated. + """ + + AUTOMATED = "Automated" + STANDARD = "Standard" + + +class OperationTypeSHM(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """OperationTypeSHM.""" + + INITIATE_SESSION_HOST_UPDATE = "InitiateSessionHostUpdate" + VALIDATE_SESSION_HOST_UPDATE = "ValidateSessionHostUpdate" class PackageTimestamped(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -227,6 +312,15 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): CANCELED = "Canceled" +class ProvisioningStateSHC(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Provisioning state of the Session Host Configuration.""" + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + PROVISIONING = "Provisioning" + + class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enabled allows this resource to be accessed from both public and private networks, Disabled allows this resource to only be accessed via private endpoints. @@ -236,6 +330,18 @@ class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" +class PublicUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RegistrationTokenOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of resetting the token.""" @@ -244,6 +350,18 @@ class RegistrationTokenOperation(str, Enum, metaclass=CaseInsensitiveEnumMeta): UPDATE = "Update" +class RelayUDP(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Default: AVD-wide settings are used to determine connection availability, Enabled: UDP will + attempt this connection type when making connections. This means that this connection is + possible, but is not guaranteed, as there are other factors that may prevent this connection + type, Disabled: UDP will not attempt this connection type when making connections. + """ + + DEFAULT = "Default" + ENABLED = "Enabled" + DISABLED = "Disabled" + + class RemoteApplicationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Resource Type of Application.""" @@ -256,6 +374,10 @@ class ScalingHostPoolType(str, Enum, metaclass=CaseInsensitiveEnumMeta): POOLED = "Pooled" """Users get a new (random) SessionHost every time it connects to the HostPool.""" + PERSONAL = "Personal" + """Users will be assigned a SessionHost either by administrators (PersonalDesktopAssignmentType = + Direct) or upon connecting to the pool (PersonalDesktopAssignmentType = Automatic). They will + always be redirected to their assigned SessionHost.""" class ScalingScheduleDaysOfWeekItem(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -389,6 +511,15 @@ class StopHostsWhen(str, Enum, metaclass=CaseInsensitiveEnumMeta): ZERO_ACTIVE_SESSIONS = "ZeroActiveSessions" +class Type(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The type of image session hosts use in the hostpool.""" + + MARKETPLACE = "Marketplace" + """Using default marketplace images offered by Azure Marketplace.""" + CUSTOM = "Custom" + """Using a custom image.""" + + class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Update state of a SessionHost.""" @@ -397,3 +528,26 @@ class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): STARTED = "Started" SUCCEEDED = "Succeeded" FAILED = "Failed" + + +class VirtualMachineDiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The disk type used by virtual machine in hostpool session host.""" + + STANDARD_LRS = "Standard_LRS" + """Standard HDD locally redundant storage. Best for backup, non-critical, and infrequent access.""" + PREMIUM_LRS = "Premium_LRS" + """Premium SSD locally redundant storage. Best for production and performance sensitive workloads.""" + STANDARD_SSD_LRS = "StandardSSD_LRS" + """Standard SSD locally redundant storage. Best for web servers, lightly used enterprise + applications and dev/test.""" + + +class VirtualMachineSecurityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The security type used by virtual machine in hostpool session host. Default is Standard.""" + + STANDARD = "Standard" + """Standard security protocol. No additional parameters""" + TRUSTED_LAUNCH = "TrustedLaunch" + """TrustedLaunch allows for secure boot adn vTPM""" + CONFIDENTIAL_VM = "ConfidentialVM" + """Confidential Virtual Machine security protocol""" 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 fa56640fb1de..59bde72bfbc1 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 @@ -8,7 +8,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union +from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union from .. import _serialization @@ -17,6 +17,329 @@ from .. import models as _models +class ActiveDirectoryInfoPatchProperties(_serialization.Model): + """Active directory info. Only one should be populated based on the join type. + + :ivar domain_credentials: Credentials needed to create the virtual machine. + :vartype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + """ + + _attribute_map = { + "domain_credentials": {"key": "domainCredentials", "type": "KeyVaultCredentialsPatchProperties"}, + } + + def __init__( + self, *, domain_credentials: Optional["_models.KeyVaultCredentialsPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword domain_credentials: Credentials needed to create the virtual machine. + :paramtype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + """ + super().__init__(**kwargs) + self.domain_credentials = domain_credentials + + +class ActiveDirectoryInfoProperties(_serialization.Model): + """Active directory info. Only one should be populated based on the join type. + + All required parameters must be populated in order to send to server. + + :ivar domain_credentials: Credentials needed to create the virtual machine. Required. + :vartype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar ou_path: The organizational unit(OU) path. Required. + :vartype ou_path: str + :ivar domain_name: The domain a virtual machine connected to a hostpool will join. + :vartype domain_name: str + """ + + _validation = { + "domain_credentials": {"required": True}, + "ou_path": {"required": True}, + } + + _attribute_map = { + "domain_credentials": {"key": "domainCredentials", "type": "KeyVaultCredentialsProperties"}, + "ou_path": {"key": "ouPath", "type": "str"}, + "domain_name": {"key": "domainName", "type": "str"}, + } + + def __init__( + self, + *, + domain_credentials: "_models.KeyVaultCredentialsProperties", + ou_path: str, + domain_name: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword domain_credentials: Credentials needed to create the virtual machine. Required. + :paramtype domain_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword ou_path: The organizational unit(OU) path. Required. + :paramtype ou_path: str + :keyword domain_name: The domain a virtual machine connected to a hostpool will join. + :paramtype domain_name: str + """ + super().__init__(**kwargs) + self.domain_credentials = domain_credentials + self.ou_path = ou_path + self.domain_name = domain_name + + +class Resource(_serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ActiveSessionHostConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """Represents a ActiveSessionHostConfiguration definition. This has all of the + sessionHostConfiguration properties except provisioningState. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar version: The timestamp of the last update. + :vartype version: ~datetime.datetime + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. It will default to the + location of the hostpool if not provided. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. Required. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. Required. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :vartype vm_size_id: str + :ivar disk_info: Disk information. Required. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. Required. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :ivar domain_info: Domain configurations of session hosts. Required. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. Required. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "version": {"readonly": True}, + "friendly_name": {"max_length": 260}, + "vm_name_prefix": {"required": True, "max_length": 11}, + "network_info": {"required": True}, + "vm_size_id": {"required": True}, + "disk_info": {"required": True}, + "image_info": {"required": True}, + "domain_info": {"required": True}, + "vm_admin_credentials": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "version": {"key": "properties.version", "type": "iso-8601"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsProperties"}, + "boot_diagnostics_info": {"key": "properties.bootDiagnosticsInfo", "type": "BootDiagnosticsInfoProperties"}, + } + + def __init__( + self, + *, + vm_name_prefix: str, + network_info: "_models.NetworkInfoProperties", + vm_size_id: str, + disk_info: "_models.DiskInfoProperties", + image_info: "_models.ImageInfoProperties", + domain_info: "_models.DomainInfoProperties", + vm_admin_credentials: "_models.KeyVaultCredentialsProperties", + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + custom_configuration_script_url: Optional[str] = None, + security_info: Optional["_models.SecurityInfoProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. It will default to + the location of the hostpool if not provided. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + Required. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. Required. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. Required. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. Required. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :keyword domain_info: Domain configurations of session hosts. Required. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. Required. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + super().__init__(**kwargs) + self.version = None + self.friendly_name = friendly_name + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info + + +class ActiveSessionHostConfigurationList(_serialization.Model): + """List of ActiveSessionHostConfiguration definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of ActiveSessionHostConfiguration definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :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": "[ActiveSessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.ActiveSessionHostConfiguration"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of ActiveSessionHostConfiguration definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + class AgentUpdatePatchProperties(_serialization.Model): """The session host configuration for updating agent, monitoring agent, and stack component. @@ -127,47 +450,6 @@ def __init__( self.maintenance_windows = maintenance_windows -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - class TrackedResource(Resource): """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. @@ -292,14 +574,15 @@ class AppAttachPackageInfoProperties(_serialization.Model): # pylint: disable=t :ivar package_alias: Alias of App Attach Package. Assigned at import time. :vartype package_alias: str - :ivar image_path: VHD/CIM image path on Network Share. + :ivar image_path: VHD/CIM/APP-V 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. + :ivar package_family_name: Identifier not including the package version, for Msix packages it + is the family name from the appxmanifest.xml. :vartype package_family_name: str - :ivar package_full_name: Package Full Name from appxmanifest.xml. + :ivar package_full_name: Identifier including the package version, for Msix packages it is the + full name from the appxmanifest.xml. :vartype package_full_name: str :ivar display_name: User friendly Name to be displayed in the portal. :vartype display_name: str @@ -312,9 +595,10 @@ class AppAttachPackageInfoProperties(_serialization.Model): # pylint: disable=t :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. + :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. + :ivar last_updated: Date the package source was last updated, for Msix packages this is found + in the appxmanifest.xml. :vartype last_updated: ~datetime.datetime :ivar package_applications: List of package applications. :vartype package_applications: @@ -372,14 +656,15 @@ def __init__( """ :keyword package_alias: Alias of App Attach Package. Assigned at import time. :paramtype package_alias: str - :keyword image_path: VHD/CIM image path on Network Share. + :keyword image_path: VHD/CIM/APP-V 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. + :keyword package_family_name: Identifier not including the package version, for Msix packages + it is the family name from the appxmanifest.xml. :paramtype package_family_name: str - :keyword package_full_name: Package Full Name from appxmanifest.xml. + :keyword package_full_name: Identifier including the package version, for Msix packages it is + the full name from the appxmanifest.xml. :paramtype package_full_name: str :keyword display_name: User friendly Name to be displayed in the portal. :paramtype display_name: str @@ -392,9 +677,10 @@ def __init__( :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. + :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. + :keyword last_updated: Date the package source was last updated, for Msix packages this is + found in the appxmanifest.xml. :paramtype last_updated: ~datetime.datetime :keyword package_applications: List of package applications. :paramtype package_applications: @@ -458,7 +744,7 @@ def __init__(self, *, value: Optional[List["_models.AppAttachPackage"]] = None, class AppAttachPackagePatch(Resource): - """Schema for updatable App Attach Package properties. + """Schema for patchable App Attach Package properties. Variables are only populated by the server, and will be ignored when sending a request. @@ -473,6 +759,8 @@ class AppAttachPackagePatch(Resource): :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar tags: tags to be updated. + :vartype tags: dict[str, str] :ivar properties: Detailed properties for App Attach Package. :vartype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties """ @@ -489,17 +777,25 @@ class AppAttachPackagePatch(Resource): "name": {"key": "name", "type": "str"}, "type": {"key": "type", "type": "str"}, "system_data": {"key": "systemData", "type": "SystemData"}, + "tags": {"key": "tags", "type": "{str}"}, "properties": {"key": "properties", "type": "AppAttachPackagePatchProperties"}, } def __init__( - self, *, properties: Optional["_models.AppAttachPackagePatchProperties"] = None, **kwargs: Any + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AppAttachPackagePatchProperties"] = None, + **kwargs: Any ) -> None: """ + :keyword tags: tags to be updated. + :paramtype tags: dict[str, str] :keyword properties: Detailed properties for App Attach Package. :paramtype properties: ~azure.mgmt.desktopvirtualization.models.AppAttachPackagePatchProperties """ super().__init__(**kwargs) + self.tags = tags self.properties = properties @@ -510,13 +806,19 @@ class AppAttachPackagePatchProperties(_serialization.Model): :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties :ivar host_pool_references: List of Hostpool resource Ids. :vartype host_pool_references: list[str] - :ivar key_vault_url: URL path to certificate name located in keyVault. + :ivar key_vault_url: URL of keyvault location to store certificate. :vartype key_vault_url: str :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and "DoNotFail". :vartype fail_health_check_on_staging_failure: str or ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :ivar package_lookback_url: Lookback url to third party control plane, should be null for first + party packages. + :vartype package_lookback_url: str + :ivar custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :vartype custom_data: str """ _attribute_map = { @@ -524,6 +826,8 @@ class AppAttachPackagePatchProperties(_serialization.Model): "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, "key_vault_url": {"key": "keyVaultURL", "type": "str"}, "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + "package_lookback_url": {"key": "packageLookbackUrl", "type": "str"}, + "custom_data": {"key": "customData", "type": "str"}, } def __init__( @@ -533,6 +837,8 @@ def __init__( host_pool_references: Optional[List[str]] = None, key_vault_url: Optional[str] = None, fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + package_lookback_url: Optional[str] = None, + custom_data: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -540,19 +846,27 @@ def __init__( :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties :keyword host_pool_references: List of Hostpool resource Ids. :paramtype host_pool_references: list[str] - :keyword key_vault_url: URL path to certificate name located in keyVault. + :keyword key_vault_url: URL of keyvault location to store certificate. :paramtype key_vault_url: str :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and "DoNotFail". :paramtype fail_health_check_on_staging_failure: str or ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :keyword package_lookback_url: Lookback url to third party control plane, should be null for + first party packages. + :paramtype package_lookback_url: str + :keyword custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :paramtype custom_data: str """ super().__init__(**kwargs) self.image = image self.host_pool_references = host_pool_references self.key_vault_url = key_vault_url self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure + self.package_lookback_url = package_lookback_url + self.custom_data = custom_data class AppAttachPackageProperties(_serialization.Model): @@ -567,13 +881,22 @@ class AppAttachPackageProperties(_serialization.Model): :vartype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties :ivar host_pool_references: List of Hostpool resource Ids. :vartype host_pool_references: list[str] - :ivar key_vault_url: URL path to certificate name located in keyVault. + :ivar key_vault_url: URL of keyvault location to store certificate. :vartype key_vault_url: str :ivar fail_health_check_on_staging_failure: Parameter indicating how the health check should behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and "DoNotFail". :vartype fail_health_check_on_staging_failure: str or ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :ivar package_owner_name: Specific name of package owner, is "AppAttach" for native app attach + packages. + :vartype package_owner_name: str + :ivar package_lookback_url: Lookback url to third party control plane, is null for native app + attach packages. + :vartype package_lookback_url: str + :ivar custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :vartype custom_data: str """ _validation = { @@ -586,6 +909,9 @@ class AppAttachPackageProperties(_serialization.Model): "host_pool_references": {"key": "hostPoolReferences", "type": "[str]"}, "key_vault_url": {"key": "keyVaultURL", "type": "str"}, "fail_health_check_on_staging_failure": {"key": "failHealthCheckOnStagingFailure", "type": "str"}, + "package_owner_name": {"key": "packageOwnerName", "type": "str"}, + "package_lookback_url": {"key": "packageLookbackUrl", "type": "str"}, + "custom_data": {"key": "customData", "type": "str"}, } def __init__( @@ -595,6 +921,9 @@ def __init__( host_pool_references: Optional[List[str]] = None, key_vault_url: Optional[str] = None, fail_health_check_on_staging_failure: Optional[Union[str, "_models.FailHealthCheckOnStagingFailure"]] = None, + package_owner_name: Optional[str] = None, + package_lookback_url: Optional[str] = None, + custom_data: Optional[str] = None, **kwargs: Any ) -> None: """ @@ -602,13 +931,22 @@ def __init__( :paramtype image: ~azure.mgmt.desktopvirtualization.models.AppAttachPackageInfoProperties :keyword host_pool_references: List of Hostpool resource Ids. :paramtype host_pool_references: list[str] - :keyword key_vault_url: URL path to certificate name located in keyVault. + :keyword key_vault_url: URL of keyvault location to store certificate. :paramtype key_vault_url: str :keyword fail_health_check_on_staging_failure: Parameter indicating how the health check should behave if this package fails staging. Known values are: "Unhealthy", "NeedsAssistance", and "DoNotFail". :paramtype fail_health_check_on_staging_failure: str or ~azure.mgmt.desktopvirtualization.models.FailHealthCheckOnStagingFailure + :keyword package_owner_name: Specific name of package owner, is "AppAttach" for native app + attach packages. + :paramtype package_owner_name: str + :keyword package_lookback_url: Lookback url to third party control plane, is null for native + app attach packages. + :paramtype package_lookback_url: str + :keyword custom_data: Field that can be populated with custom data and filtered on in list GET + calls. + :paramtype custom_data: str """ super().__init__(**kwargs) self.provisioning_state = None @@ -616,6 +954,9 @@ def __init__( self.host_pool_references = host_pool_references self.key_vault_url = key_vault_url self.fail_health_check_on_staging_failure = fail_health_check_on_staging_failure + self.package_owner_name = package_owner_name + self.package_lookback_url = package_lookback_url + self.custom_data = custom_data class Application(Resource): # pylint: disable=too-many-instance-attributes @@ -808,13 +1149,12 @@ class ResourceModelWithAllowedPropertySet(TrackedResource): # pylint: disable=t 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 - :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 identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan """ _validation = { @@ -837,9 +1177,9 @@ class ResourceModelWithAllowedPropertySet(TrackedResource): # pylint: disable=t "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, } def __init__( @@ -849,9 +1189,9 @@ def __init__( tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, **kwargs: Any ) -> None: """ @@ -868,14 +1208,12 @@ def __init__( 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 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 identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan """ super().__init__(tags=tags, location=location, **kwargs) self.managed_by = managed_by @@ -923,13 +1261,12 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= 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 - :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 identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of ApplicationGroup. (internal use). :vartype object_id: str :ivar description: Description of ApplicationGroup. @@ -975,9 +1312,9 @@ class ApplicationGroup(ResourceModelWithAllowedPropertySet): # pylint: disable= "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -997,9 +1334,9 @@ def __init__( tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, show_in_feed: Optional[bool] = None, @@ -1019,14 +1356,12 @@ def __init__( 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 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 identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :keyword description: Description of ApplicationGroup. :paramtype description: str :keyword friendly_name: Friendly name of ApplicationGroup. @@ -1307,6 +1642,98 @@ def __init__( self.application_type = application_type +class AzureActiveDirectoryInfoProperties(_serialization.Model): + """Azure Active directory info. Only one should be populated based on the join type. + + All required parameters must be populated in order to send to server. + + :ivar mdm_provider_guid: The Mobile Device Management(MDM) guid. Required. + :vartype mdm_provider_guid: str + """ + + _validation = { + "mdm_provider_guid": {"required": True}, + } + + _attribute_map = { + "mdm_provider_guid": {"key": "mdmProviderGuid", "type": "str"}, + } + + def __init__(self, *, mdm_provider_guid: str, **kwargs: Any) -> None: + """ + :keyword mdm_provider_guid: The Mobile Device Management(MDM) guid. Required. + :paramtype mdm_provider_guid: str + """ + super().__init__(**kwargs) + self.mdm_provider_guid = mdm_provider_guid + + +class BootDiagnosticsInfoPatchProperties(_serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. :code:`
`:code:`
` You can easily view the output of your console + log. :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the + hypervisor. + + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :vartype storage_uri: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, storage_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :paramtype storage_uri: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = storage_uri + + +class BootDiagnosticsInfoProperties(_serialization.Model): + """Boot Diagnostics is a debugging feature which allows you to view Console Output and Screenshot + to diagnose VM status. :code:`
`:code:`
` You can easily view the output of your console + log. :code:`
`:code:`
` Azure also enables you to see a screenshot of the VM from the + hypervisor. + + :ivar enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :vartype enabled: bool + :ivar storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :vartype storage_uri: str + """ + + _attribute_map = { + "enabled": {"key": "enabled", "type": "bool"}, + "storage_uri": {"key": "storageUri", "type": "str"}, + } + + def __init__(self, *, enabled: Optional[bool] = None, storage_uri: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword enabled: Whether boot diagnostics should be enabled on the Virtual Machine. + :paramtype enabled: bool + :keyword storage_uri: Uri of the storage account to use for placing the console output and + screenshot. :code:`
`:code:`
`If storageUri is not specified while enabling boot + diagnostics, managed storage will be used. + :paramtype storage_uri: str + """ + super().__init__(**kwargs) + self.enabled = enabled + self.storage_uri = storage_uri + + class CloudErrorProperties(_serialization.Model): """Cloud error object properties. @@ -1333,22 +1760,68 @@ def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, self.message = message -class Desktop(Resource): - """Schema for Desktop properties. +class CustomInfoPatchProperties(_serialization.Model): + """Custom image information. - Variables are only populated by the server, and will be ignored when sending a request. + :ivar resource_id: The resource id of the custom image. + :vartype resource_id: str + """ - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource id of the custom image. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +class CustomInfoProperties(_serialization.Model): + """Custom image information. + + All required parameters must be populated in order to send to server. + + :ivar resource_id: The resource id of the custom image. Required. + :vartype resource_id: str + """ + + _validation = { + "resource_id": {"required": True}, + } + + _attribute_map = { + "resource_id": {"key": "resourceId", "type": "str"}, + } + + def __init__(self, *, resource_id: str, **kwargs: Any) -> None: + """ + :keyword resource_id: The resource id of the custom image. Required. + :paramtype resource_id: str + """ + super().__init__(**kwargs) + self.resource_id = resource_id + + +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. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData :ivar object_id: ObjectId of Desktop. (internal use). :vartype object_id: str :ivar description: Description of Desktop. @@ -1469,6 +1942,140 @@ def __init__( self.friendly_name = friendly_name +class DiskInfoPatchProperties(_serialization.Model): + """Disk information. + + :ivar type: The disk type used by virtual machine in hostpool session host. Known values are: + "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Optional[Union[str, "_models.VirtualMachineDiskType"]] = None, **kwargs: Any) -> None: + """ + :keyword type: The disk type used by virtual machine in hostpool session host. Known values + are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + super().__init__(**kwargs) + self.type = type + + +class DiskInfoProperties(_serialization.Model): + """Disk information. + + All required parameters must be populated in order to send to server. + + :ivar type: The disk type used by virtual machine in hostpool session host. Required. Known + values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + + _validation = { + "type": {"required": True}, + } + + _attribute_map = { + "type": {"key": "type", "type": "str"}, + } + + def __init__(self, *, type: Union[str, "_models.VirtualMachineDiskType"], **kwargs: Any) -> None: + """ + :keyword type: The disk type used by virtual machine in hostpool session host. Required. Known + values are: "Standard_LRS", "Premium_LRS", and "StandardSSD_LRS". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineDiskType + """ + super().__init__(**kwargs) + self.type = type + + +class DomainInfoPatchProperties(_serialization.Model): + """Domain configurations of session hosts. + + :ivar active_directory_info: Active directory info. Only one should be populated based on the + join type. + :vartype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoPatchProperties + """ + + _attribute_map = { + "active_directory_info": {"key": "activeDirectoryInfo", "type": "ActiveDirectoryInfoPatchProperties"}, + } + + def __init__( + self, *, active_directory_info: Optional["_models.ActiveDirectoryInfoPatchProperties"] = None, **kwargs: Any + ) -> None: + """ + :keyword active_directory_info: Active directory info. Only one should be populated based on + the join type. + :paramtype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoPatchProperties + """ + super().__init__(**kwargs) + self.active_directory_info = active_directory_info + + +class DomainInfoProperties(_serialization.Model): + """Domain configurations of session hosts. + + All required parameters must be populated in order to send to server. + + :ivar join_type: The type of domain join done by the virtual machine. Required. Known values + are: "ActiveDirectory" and "AzureActiveDirectory". + :vartype join_type: str or ~azure.mgmt.desktopvirtualization.models.DomainJoinType + :ivar active_directory_info: Active directory info. Only one should be populated based on the + join type. + :vartype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoProperties + :ivar azure_active_directory_info: Azure active directory info. Only one should be populated + based on the join type. + :vartype azure_active_directory_info: + ~azure.mgmt.desktopvirtualization.models.AzureActiveDirectoryInfoProperties + """ + + _validation = { + "join_type": {"required": True}, + } + + _attribute_map = { + "join_type": {"key": "joinType", "type": "str"}, + "active_directory_info": {"key": "activeDirectoryInfo", "type": "ActiveDirectoryInfoProperties"}, + "azure_active_directory_info": { + "key": "azureActiveDirectoryInfo", + "type": "AzureActiveDirectoryInfoProperties", + }, + } + + def __init__( + self, + *, + join_type: Union[str, "_models.DomainJoinType"], + active_directory_info: Optional["_models.ActiveDirectoryInfoProperties"] = None, + azure_active_directory_info: Optional["_models.AzureActiveDirectoryInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword join_type: The type of domain join done by the virtual machine. Required. Known values + are: "ActiveDirectory" and "AzureActiveDirectory". + :paramtype join_type: str or ~azure.mgmt.desktopvirtualization.models.DomainJoinType + :keyword active_directory_info: Active directory info. Only one should be populated based on + the join type. + :paramtype active_directory_info: + ~azure.mgmt.desktopvirtualization.models.ActiveDirectoryInfoProperties + :keyword azure_active_directory_info: Azure active directory info. Only one should be populated + based on the join type. + :paramtype azure_active_directory_info: + ~azure.mgmt.desktopvirtualization.models.AzureActiveDirectoryInfoProperties + """ + super().__init__(**kwargs) + self.join_type = join_type + self.active_directory_info = active_directory_info + self.azure_active_directory_info = azure_active_directory_info + + class ErrorAdditionalInfo(_serialization.Model): """The resource management error additional info. @@ -1599,7 +2206,7 @@ class ExpandMsixImage(Resource): # pylint: disable=too-many-instance-attributes :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. + :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 @@ -1684,7 +2291,7 @@ def __init__( :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. + :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 @@ -1781,13 +2388,12 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many 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 - :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 identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of HostPool. (internal use). :vartype object_id: str :ivar friendly_name: Friendly name of HostPool. @@ -1806,7 +2412,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :ivar max_session_limit: The max session limit of HostPool. :vartype max_session_limit: int :ivar load_balancer_type: The type of the load balancer. Required. Known values are: - "BreadthFirst", "DepthFirst", and "Persistent". + "BreadthFirst", "DepthFirst", "Persistent", and "MultiplePersistent". :vartype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType :ivar ring: The ring number of HostPool. :vartype ring: int @@ -1816,6 +2422,9 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many :vartype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :ivar vm_template: VM template for sessionhosts configuration within hostpool. :vartype vm_template: str + :ivar management_type: The type of management for this hostpool, Automated or Standard. The + default value is Automated. Known values are: "Automated" and "Standard". + :vartype management_type: str or ~azure.mgmt.desktopvirtualization.models.ManagementType :ivar application_group_references: List of applicationGroup links. :vartype application_group_references: list[str] :ivar app_attach_package_references: List of App Attach Package links. @@ -1853,6 +2462,30 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many specified resource. :vartype private_endpoint_connections: list[~azure.mgmt.desktopvirtualization.models.PrivateEndpointConnection] + :ivar managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :vartype managed_private_udp: str or ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :ivar direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :ivar public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :ivar relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ _validation = { @@ -1883,9 +2516,9 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, @@ -1898,6 +2531,7 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "validation_environment": {"key": "properties.validationEnvironment", "type": "bool"}, "registration_info": {"key": "properties.registrationInfo", "type": "RegistrationInfo"}, "vm_template": {"key": "properties.vmTemplate", "type": "str"}, + "management_type": {"key": "properties.managementType", "type": "str"}, "application_group_references": {"key": "properties.applicationGroupReferences", "type": "[str]"}, "app_attach_package_references": {"key": "properties.appAttachPackageReferences", "type": "[str]"}, "ssoadfs_authority": {"key": "properties.ssoadfsAuthority", "type": "str"}, @@ -1913,6 +2547,10 @@ class HostPool(ResourceModelWithAllowedPropertySet): # pylint: disable=too-many "key": "properties.privateEndpointConnections", "type": "[PrivateEndpointConnection]", }, + "managed_private_udp": {"key": "properties.managedPrivateUDP", "type": "str"}, + "direct_udp": {"key": "properties.directUDP", "type": "str"}, + "public_udp": {"key": "properties.publicUDP", "type": "str"}, + "relay_udp": {"key": "properties.relayUDP", "type": "str"}, } def __init__( # pylint: disable=too-many-locals @@ -1925,9 +2563,9 @@ def __init__( # pylint: disable=too-many-locals tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, friendly_name: Optional[str] = None, description: Optional[str] = None, personal_desktop_assignment_type: Optional[Union[str, "_models.PersonalDesktopAssignmentType"]] = None, @@ -1937,6 +2575,7 @@ def __init__( # pylint: disable=too-many-locals validation_environment: Optional[bool] = None, registration_info: Optional["_models.RegistrationInfo"] = None, vm_template: Optional[str] = None, + management_type: Optional[Union[str, "_models.ManagementType"]] = None, ssoadfs_authority: Optional[str] = None, sso_client_id: Optional[str] = None, sso_client_secret_key_vault_path: Optional[str] = None, @@ -1944,6 +2583,10 @@ def __init__( # pylint: disable=too-many-locals start_vm_on_connect: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.HostpoolPublicNetworkAccess"]] = None, agent_update: Optional["_models.AgentUpdateProperties"] = None, + managed_private_udp: Optional[Union[str, "_models.ManagedPrivateUDP"]] = None, + direct_udp: Optional[Union[str, "_models.DirectUDP"]] = None, + public_udp: Optional[Union[str, "_models.PublicUDP"]] = None, + relay_udp: Optional[Union[str, "_models.RelayUDP"]] = None, **kwargs: Any ) -> None: """ @@ -1960,14 +2603,12 @@ def __init__( # pylint: disable=too-many-locals 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 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 identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :keyword friendly_name: Friendly name of HostPool. :paramtype friendly_name: str :keyword description: Description of HostPool. @@ -1984,7 +2625,7 @@ def __init__( # pylint: disable=too-many-locals :keyword max_session_limit: The max session limit of HostPool. :paramtype max_session_limit: int :keyword load_balancer_type: The type of the load balancer. Required. Known values are: - "BreadthFirst", "DepthFirst", and "Persistent". + "BreadthFirst", "DepthFirst", "Persistent", and "MultiplePersistent". :paramtype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType :keyword ring: The ring number of HostPool. :paramtype ring: int @@ -1994,6 +2635,9 @@ def __init__( # pylint: disable=too-many-locals :paramtype registration_info: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo :keyword vm_template: VM template for sessionhosts configuration within hostpool. :paramtype vm_template: str + :keyword management_type: The type of management for this hostpool, Automated or Standard. The + default value is Automated. Known values are: "Automated" and "Standard". + :paramtype management_type: str or ~azure.mgmt.desktopvirtualization.models.ManagementType :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 @@ -2021,6 +2665,31 @@ def __init__( # pylint: disable=too-many-locals :keyword agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdateProperties + :keyword managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :paramtype managed_private_udp: str or + ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :keyword direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :keyword public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :keyword relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ super().__init__( tags=tags, @@ -2044,6 +2713,7 @@ def __init__( # pylint: disable=too-many-locals self.validation_environment = validation_environment self.registration_info = registration_info self.vm_template = vm_template + self.management_type = management_type self.application_group_references = None self.app_attach_package_references = None self.ssoadfs_authority = ssoadfs_authority @@ -2056,6 +2726,10 @@ def __init__( # pylint: disable=too-many-locals self.public_network_access = public_network_access self.agent_update = agent_update self.private_endpoint_connections = None + self.managed_private_udp = managed_private_udp + self.direct_udp = direct_udp + self.public_udp = public_udp + self.relay_udp = relay_udp class HostPoolList(_serialization.Model): @@ -2119,7 +2793,7 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes :vartype personal_desktop_assignment_type: str or ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType :ivar load_balancer_type: The type of the load balancer. Known values are: "BreadthFirst", - "DepthFirst", and "Persistent". + "DepthFirst", "Persistent", and "MultiplePersistent". :vartype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType :ivar ring: The ring number of HostPool. :vartype ring: int @@ -2154,6 +2828,30 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes :ivar agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :vartype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + :ivar managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :vartype managed_private_udp: str or ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :ivar direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :ivar public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :ivar relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :vartype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ _validation = { @@ -2187,9 +2885,13 @@ class HostPoolPatch(Resource): # pylint: disable=too-many-instance-attributes "start_vm_on_connect": {"key": "properties.startVMOnConnect", "type": "bool"}, "public_network_access": {"key": "properties.publicNetworkAccess", "type": "str"}, "agent_update": {"key": "properties.agentUpdate", "type": "AgentUpdatePatchProperties"}, + "managed_private_udp": {"key": "properties.managedPrivateUDP", "type": "str"}, + "direct_udp": {"key": "properties.directUDP", "type": "str"}, + "public_udp": {"key": "properties.publicUDP", "type": "str"}, + "relay_udp": {"key": "properties.relayUDP", "type": "str"}, } - def __init__( + def __init__( # pylint: disable=too-many-locals self, *, tags: Optional[Dict[str, str]] = None, @@ -2211,6 +2913,10 @@ def __init__( start_vm_on_connect: Optional[bool] = None, public_network_access: Optional[Union[str, "_models.HostpoolPublicNetworkAccess"]] = None, agent_update: Optional["_models.AgentUpdatePatchProperties"] = None, + managed_private_udp: Optional[Union[str, "_models.ManagedPrivateUDP"]] = None, + direct_udp: Optional[Union[str, "_models.DirectUDP"]] = None, + public_udp: Optional[Union[str, "_models.PublicUDP"]] = None, + relay_udp: Optional[Union[str, "_models.RelayUDP"]] = None, **kwargs: Any ) -> None: """ @@ -2229,7 +2935,7 @@ def __init__( :paramtype personal_desktop_assignment_type: str or ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType :keyword load_balancer_type: The type of the load balancer. Known values are: "BreadthFirst", - "DepthFirst", and "Persistent". + "DepthFirst", "Persistent", and "MultiplePersistent". :paramtype load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType :keyword ring: The ring number of HostPool. :paramtype ring: int @@ -2264,6 +2970,31 @@ def __init__( :keyword agent_update: The session host configuration for updating agent, monitoring agent, and stack component. :paramtype agent_update: ~azure.mgmt.desktopvirtualization.models.AgentUpdatePatchProperties + :keyword managed_private_udp: Default: AVD-wide settings are used to determine connection + availability, Enabled: UDP will attempt this connection type when making connections. This + means that this connection is possible, but is not guaranteed, as there are other factors that + may prevent this connection type, Disabled: UDP will not attempt this connection type when + making connections. Known values are: "Default", "Enabled", and "Disabled". + :paramtype managed_private_udp: str or + ~azure.mgmt.desktopvirtualization.models.ManagedPrivateUDP + :keyword direct_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype direct_udp: str or ~azure.mgmt.desktopvirtualization.models.DirectUDP + :keyword public_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype public_udp: str or ~azure.mgmt.desktopvirtualization.models.PublicUDP + :keyword relay_udp: Default: AVD-wide settings are used to determine connection availability, + Enabled: UDP will attempt this connection type when making connections. This means that this + connection is possible, but is not guaranteed, as there are other factors that may prevent this + connection type, Disabled: UDP will not attempt this connection type when making connections. + Known values are: "Default", "Enabled", and "Disabled". + :paramtype relay_udp: str or ~azure.mgmt.desktopvirtualization.models.RelayUDP """ super().__init__(**kwargs) self.tags = tags @@ -2285,41 +3016,305 @@ def __init__( self.start_vm_on_connect = start_vm_on_connect self.public_network_access = public_network_access self.agent_update = agent_update + self.managed_private_udp = managed_private_udp + self.direct_udp = direct_udp + self.public_udp = public_udp + self.relay_udp = relay_udp + + +class HostPoolUpdateConfigurationPatchProperties(_serialization.Model): # pylint: disable=name-too-long + """The configurations of a hostpool update. + + :ivar delete_original_vm: Whether not to save original disk. False by default. + :vartype delete_original_vm: bool + :ivar max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. + :vartype max_vms_removed: int + :ivar log_off_delay_minutes: Grace period before logging off users in minutes. + :vartype log_off_delay_minutes: int + :ivar log_off_message: Log off message sent to user for logoff. + :vartype log_off_message: str + """ + + _validation = { + "max_vms_removed": {"minimum": 1}, + "log_off_message": {"max_length": 260}, + } + + _attribute_map = { + "delete_original_vm": {"key": "deleteOriginalVm", "type": "bool"}, + "max_vms_removed": {"key": "maxVmsRemoved", "type": "int"}, + "log_off_delay_minutes": {"key": "logOffDelayMinutes", "type": "int"}, + "log_off_message": {"key": "logOffMessage", "type": "str"}, + } + def __init__( + self, + *, + delete_original_vm: Optional[bool] = None, + max_vms_removed: Optional[int] = None, + log_off_delay_minutes: Optional[int] = None, + log_off_message: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword delete_original_vm: Whether not to save original disk. False by default. + :paramtype delete_original_vm: bool + :keyword max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. + :paramtype max_vms_removed: int + :keyword log_off_delay_minutes: Grace period before logging off users in minutes. + :paramtype log_off_delay_minutes: int + :keyword log_off_message: Log off message sent to user for logoff. + :paramtype log_off_message: str + """ + super().__init__(**kwargs) + self.delete_original_vm = delete_original_vm + self.max_vms_removed = max_vms_removed + self.log_off_delay_minutes = log_off_delay_minutes + self.log_off_message = log_off_message -class Identity(_serialization.Model): - """Identity for the resource. - Variables are only populated by the server, and will be ignored when sending a request. +class HostPoolUpdateConfigurationProperties(_serialization.Model): + """The configurations of a hostpool update. - :ivar principal_id: The principal ID of resource identity. The value must be an UUID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. The value must be an UUID. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str + All required parameters must be populated in order to send to server. + + :ivar delete_original_vm: Whether not to save original disk. False by default. + :vartype delete_original_vm: bool + :ivar max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. Required. + :vartype max_vms_removed: int + :ivar log_off_delay_minutes: Grace period before logging off users in minutes. Required. + :vartype log_off_delay_minutes: int + :ivar log_off_message: Log off message sent to user for logoff. Default value is an empty + string. + :vartype log_off_message: str """ _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, + "max_vms_removed": {"required": True, "minimum": 1}, + "log_off_delay_minutes": {"required": True}, + "log_off_message": {"max_length": 260}, } _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, + "delete_original_vm": {"key": "deleteOriginalVm", "type": "bool"}, + "max_vms_removed": {"key": "maxVmsRemoved", "type": "int"}, + "log_off_delay_minutes": {"key": "logOffDelayMinutes", "type": "int"}, + "log_off_message": {"key": "logOffMessage", "type": "str"}, } - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: + def __init__( + self, + *, + max_vms_removed: int, + log_off_delay_minutes: int, + delete_original_vm: Optional[bool] = None, + log_off_message: str = "", + **kwargs: Any + ) -> None: """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str + :keyword delete_original_vm: Whether not to save original disk. False by default. + :paramtype delete_original_vm: bool + :keyword max_vms_removed: The maximum number of virtual machines to be removed during hostpool + update. Required. + :paramtype max_vms_removed: int + :keyword log_off_delay_minutes: Grace period before logging off users in minutes. Required. + :paramtype log_off_delay_minutes: int + :keyword log_off_message: Log off message sent to user for logoff. Default value is an empty + string. + :paramtype log_off_message: str """ super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type + self.delete_original_vm = delete_original_vm + self.max_vms_removed = max_vms_removed + self.log_off_delay_minutes = log_off_delay_minutes + self.log_off_message = log_off_message + + +class HostPoolUpdateControlParameter(_serialization.Model): + """Represents properties for a hostpool update control request. + + All required parameters must be populated in order to send to server. + + :ivar action: Action types for controlling hostpool update. Required. Known values are: + "Start", "Pause", "Cancel", "Retry", and "Resume". + :vartype action: str or ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateAction + :ivar cancel_message: The cancel message sent to the user on the session host. This is can only + be specified if the action is 'Cancel'. + :vartype cancel_message: str + """ + + _validation = { + "action": {"required": True}, + "cancel_message": {"max_length": 260}, + } + + _attribute_map = { + "action": {"key": "action", "type": "str"}, + "cancel_message": {"key": "cancelMessage", "type": "str"}, + } + + def __init__( + self, *, action: Union[str, "_models.HostPoolUpdateAction"], cancel_message: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword action: Action types for controlling hostpool update. Required. Known values are: + "Start", "Pause", "Cancel", "Retry", and "Resume". + :paramtype action: str or ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateAction + :keyword cancel_message: The cancel message sent to the user on the session host. This is can + only be specified if the action is 'Cancel'. + :paramtype cancel_message: str + """ + super().__init__(**kwargs) + self.action = action + self.cancel_message = cancel_message + + +class HostPoolUpdateFault(_serialization.Model): + """Hostpool update fault information. + + :ivar fault_type: Hostpool update fault type. Known values are: "ServiceError" and "UserError". + :vartype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :ivar fault_code: Hostpool update fault code. + :vartype fault_code: str + :ivar fault_text: Hostpool update fault text. + :vartype fault_text: str + :ivar fault_context: Hostpool update fault context. + :vartype fault_context: str + """ + + _attribute_map = { + "fault_type": {"key": "faultType", "type": "str"}, + "fault_code": {"key": "faultCode", "type": "str"}, + "fault_text": {"key": "faultText", "type": "str"}, + "fault_context": {"key": "faultContext", "type": "str"}, + } + + def __init__( + self, + *, + fault_type: Optional[Union[str, "_models.FaultType"]] = None, + fault_code: Optional[str] = None, + fault_text: Optional[str] = None, + fault_context: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword fault_type: Hostpool update fault type. Known values are: "ServiceError" and + "UserError". + :paramtype fault_type: str or ~azure.mgmt.desktopvirtualization.models.FaultType + :keyword fault_code: Hostpool update fault code. + :paramtype fault_code: str + :keyword fault_text: Hostpool update fault text. + :paramtype fault_text: str + :keyword fault_context: Hostpool update fault context. + :paramtype fault_context: str + """ + super().__init__(**kwargs) + self.fault_type = fault_type + self.fault_code = fault_code + self.fault_text = fault_text + self.fault_context = fault_context + + +class ImageInfoPatchProperties(_serialization.Model): + """Image configurations of session host in a HostPool. + + :ivar image_type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :vartype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :ivar marketplace_info: The values to uniquely identify a marketplace image. Only one should be + populated based on the image type. + :vartype marketplace_info: + ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoPatchProperties + :ivar custom_info: The values to uniquely identify a custom image. Only one should be populated + based on the image type. + :vartype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoPatchProperties + """ + + _attribute_map = { + "image_type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoPatchProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoPatchProperties"}, + } + + def __init__( + self, + *, + image_type: Optional[Union[str, "_models.Type"]] = None, + marketplace_info: Optional["_models.MarketplaceInfoPatchProperties"] = None, + custom_info: Optional["_models.CustomInfoPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword image_type: The type of image session hosts use in the hostpool. Known values are: + "Marketplace" and "Custom". + :paramtype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :keyword marketplace_info: The values to uniquely identify a marketplace image. Only one should + be populated based on the image type. + :paramtype marketplace_info: + ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoPatchProperties + :keyword custom_info: The values to uniquely identify a custom image. Only one should be + populated based on the image type. + :paramtype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoPatchProperties + """ + super().__init__(**kwargs) + self.image_type = image_type + self.marketplace_info = marketplace_info + self.custom_info = custom_info + + +class ImageInfoProperties(_serialization.Model): + """Image configurations of session host in a HostPool. + + All required parameters must be populated in order to send to server. + + :ivar image_type: The type of image session hosts use in the hostpool. Required. Known values + are: "Marketplace" and "Custom". + :vartype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :ivar marketplace_info: The values to uniquely identify a marketplace image. Only one should be + populated based on the image type. + :vartype marketplace_info: ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoProperties + :ivar custom_info: The values to uniquely identify a custom image. Only one should be populated + based on the image type. + :vartype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoProperties + """ + + _validation = { + "image_type": {"required": True}, + } + + _attribute_map = { + "image_type": {"key": "type", "type": "str"}, + "marketplace_info": {"key": "marketplaceInfo", "type": "MarketplaceInfoProperties"}, + "custom_info": {"key": "customInfo", "type": "CustomInfoProperties"}, + } + + def __init__( + self, + *, + image_type: Union[str, "_models.Type"], + marketplace_info: Optional["_models.MarketplaceInfoProperties"] = None, + custom_info: Optional["_models.CustomInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword image_type: The type of image session hosts use in the hostpool. Required. Known + values are: "Marketplace" and "Custom". + :paramtype image_type: str or ~azure.mgmt.desktopvirtualization.models.Type + :keyword marketplace_info: The values to uniquely identify a marketplace image. Only one should + be populated based on the image type. + :paramtype marketplace_info: ~azure.mgmt.desktopvirtualization.models.MarketplaceInfoProperties + :keyword custom_info: The values to uniquely identify a custom image. Only one should be + populated based on the image type. + :paramtype custom_info: ~azure.mgmt.desktopvirtualization.models.CustomInfoProperties + """ + super().__init__(**kwargs) + self.image_type = image_type + self.marketplace_info = marketplace_info + self.custom_info = custom_info class ImportPackageInfoRequest(_serialization.Model): @@ -2358,6 +3353,81 @@ def __init__( self.package_architecture = package_architecture +class KeyVaultCredentialsPatchProperties(_serialization.Model): + """Credentials kept in the keyvault. + + :ivar username_key_vault_secret_uri: The uri to access the secret that the username is stored + in. + :vartype username_key_vault_secret_uri: str + :ivar password_key_vault_secret_uri: The uri to access the secret that the password is stored + in. + :vartype password_key_vault_secret_uri: str + """ + + _attribute_map = { + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, + } + + def __init__( + self, + *, + username_key_vault_secret_uri: Optional[str] = None, + password_key_vault_secret_uri: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword username_key_vault_secret_uri: The uri to access the secret that the username is + stored in. + :paramtype username_key_vault_secret_uri: str + :keyword password_key_vault_secret_uri: The uri to access the secret that the password is + stored in. + :paramtype password_key_vault_secret_uri: str + """ + super().__init__(**kwargs) + self.username_key_vault_secret_uri = username_key_vault_secret_uri + self.password_key_vault_secret_uri = password_key_vault_secret_uri + + +class KeyVaultCredentialsProperties(_serialization.Model): + """Credentials kept in the keyvault. + + All required parameters must be populated in order to send to server. + + :ivar username_key_vault_secret_uri: The uri to access the secret that the username is stored + in. Required. + :vartype username_key_vault_secret_uri: str + :ivar password_key_vault_secret_uri: The uri to access the secret that the password is stored + in. Required. + :vartype password_key_vault_secret_uri: str + """ + + _validation = { + "username_key_vault_secret_uri": {"required": True}, + "password_key_vault_secret_uri": {"required": True}, + } + + _attribute_map = { + "username_key_vault_secret_uri": {"key": "usernameKeyVaultSecretUri", "type": "str"}, + "password_key_vault_secret_uri": {"key": "passwordKeyVaultSecretUri", "type": "str"}, + } + + def __init__( + self, *, username_key_vault_secret_uri: str, password_key_vault_secret_uri: str, **kwargs: Any + ) -> None: + """ + :keyword username_key_vault_secret_uri: The uri to access the secret that the username is + stored in. Required. + :paramtype username_key_vault_secret_uri: str + :keyword password_key_vault_secret_uri: The uri to access the secret that the password is + stored in. Required. + :paramtype password_key_vault_secret_uri: str + """ + super().__init__(**kwargs) + self.username_key_vault_secret_uri = username_key_vault_secret_uri + self.password_key_vault_secret_uri = password_key_vault_secret_uri + + class LogSpecification(_serialization.Model): """Specifications of the Log for Azure Monitoring. @@ -2465,18 +3535,175 @@ def __init__( self.day_of_week = day_of_week -class MSIXImageURI(_serialization.Model): - """Represents URI referring to MSIX Image. +class ManagedServiceIdentity(_serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). - :ivar uri: URI to Image. - :vartype uri: str - """ + Variables are only populated by the server, and will be ignored when sending a request. - _attribute_map = { - "uri": {"key": "uri", "type": "str"}, - } + All required parameters must be populated in order to send to server. - def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types + are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.desktopvirtualization.models.UserAssignedIdentity] + """ + + _validation = { + "principal_id": {"readonly": True}, + "tenant_id": {"readonly": True}, + "type": {"required": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "tenant_id": {"key": "tenantId", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, + } + + def __init__( + self, + *, + type: Union[str, "_models.ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned + types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and + "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.desktopvirtualization.models.UserAssignedIdentity] + """ + super().__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class MarketplaceInfoPatchProperties(_serialization.Model): + """Marketplace image information. + + :ivar offer: The offer of the image. + :vartype offer: str + :ivar publisher: The publisher of the image. + :vartype publisher: str + :ivar sku: The sku of the image. + :vartype sku: str + :ivar exact_version: The exact version of the image. + :vartype exact_version: str + """ + + _attribute_map = { + "offer": {"key": "offer", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "exact_version": {"key": "exactVersion", "type": "str"}, + } + + def __init__( + self, + *, + offer: Optional[str] = None, + publisher: Optional[str] = None, + sku: Optional[str] = None, + exact_version: Optional[str] = None, + **kwargs: Any + ) -> None: + """ + :keyword offer: The offer of the image. + :paramtype offer: str + :keyword publisher: The publisher of the image. + :paramtype publisher: str + :keyword sku: The sku of the image. + :paramtype sku: str + :keyword exact_version: The exact version of the image. + :paramtype exact_version: str + """ + super().__init__(**kwargs) + self.offer = offer + self.publisher = publisher + self.sku = sku + self.exact_version = exact_version + + +class MarketplaceInfoProperties(_serialization.Model): + """Marketplace image information. + + All required parameters must be populated in order to send to server. + + :ivar offer: The offer of the image. Required. + :vartype offer: str + :ivar publisher: The publisher of the image. Required. + :vartype publisher: str + :ivar sku: The sku of the image. Required. + :vartype sku: str + :ivar exact_version: The exact version of the image. Required. + :vartype exact_version: str + """ + + _validation = { + "offer": {"required": True}, + "publisher": {"required": True}, + "sku": {"required": True}, + "exact_version": {"required": True}, + } + + _attribute_map = { + "offer": {"key": "offer", "type": "str"}, + "publisher": {"key": "publisher", "type": "str"}, + "sku": {"key": "sku", "type": "str"}, + "exact_version": {"key": "exactVersion", "type": "str"}, + } + + def __init__(self, *, offer: str, publisher: str, sku: str, exact_version: str, **kwargs: Any) -> None: + """ + :keyword offer: The offer of the image. Required. + :paramtype offer: str + :keyword publisher: The publisher of the image. Required. + :paramtype publisher: str + :keyword sku: The sku of the image. Required. + :paramtype sku: str + :keyword exact_version: The exact version of the image. Required. + :paramtype exact_version: str + """ + super().__init__(**kwargs) + self.offer = offer + self.publisher = publisher + self.sku = sku + self.exact_version = exact_version + + +class MSIXImageURI(_serialization.Model): + """Represents URI referring to MSIX Image. + + :ivar uri: URI to Image. + :vartype uri: str + """ + + _attribute_map = { + "uri": {"key": "uri", "type": "str"}, + } + + def __init__(self, *, uri: Optional[str] = None, **kwargs: Any) -> None: """ :keyword uri: URI to Image. :paramtype uri: str @@ -2519,7 +3746,7 @@ class MSIXPackage(Resource): # pylint: disable=too-many-instance-attributes :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. + :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 @@ -2588,7 +3815,7 @@ def __init__( :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. + :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 @@ -2682,7 +3909,9 @@ def __init__( class MsixPackageDependencies(_serialization.Model): """Schema for MSIX Package Dependencies properties. - :ivar dependency_name: Name of package dependency. + :ivar dependency_name: Name of the package dependency. For Msix packages, this is the other + packages this package depends upon, for APP-V packages this is the locations of the user and + deployment config files. :vartype dependency_name: str :ivar publisher: Name of dependency publisher. :vartype publisher: str @@ -2705,7 +3934,9 @@ def __init__( **kwargs: Any ) -> None: """ - :keyword dependency_name: Name of package dependency. + :keyword dependency_name: Name of the package dependency. For Msix packages, this is the other + packages this package depends upon, for APP-V packages this is the locations of the user and + deployment config files. :paramtype dependency_name: str :keyword publisher: Name of dependency publisher. :paramtype publisher: str @@ -2811,6 +4042,70 @@ def __init__( self.display_name = display_name +class NetworkInfoPatchProperties(_serialization.Model): + """Network information. + + :ivar subnet_id: The resource ID of the subnet. + :vartype subnet_id: str + :ivar security_group_id: The resource ID of the security group. Any allowable/open ports should + be specified in the Network Security Group(NSG). + :vartype security_group_id: str + """ + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "security_group_id": {"key": "securityGroupId", "type": "str"}, + } + + def __init__( + self, *, subnet_id: Optional[str] = None, security_group_id: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword subnet_id: The resource ID of the subnet. + :paramtype subnet_id: str + :keyword security_group_id: The resource ID of the security group. Any allowable/open ports + should be specified in the Network Security Group(NSG). + :paramtype security_group_id: str + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.security_group_id = security_group_id + + +class NetworkInfoProperties(_serialization.Model): + """Network information. + + All required parameters must be populated in order to send to server. + + :ivar subnet_id: The resource ID of the subnet. Required. + :vartype subnet_id: str + :ivar security_group_id: The resource ID of the security group. Any allowable/open ports should + be specified in the Network Security Group(NSG). + :vartype security_group_id: str + """ + + _validation = { + "subnet_id": {"required": True}, + } + + _attribute_map = { + "subnet_id": {"key": "subnetId", "type": "str"}, + "security_group_id": {"key": "securityGroupId", "type": "str"}, + } + + def __init__(self, *, subnet_id: str, security_group_id: Optional[str] = None, **kwargs: Any) -> None: + """ + :keyword subnet_id: The resource ID of the subnet. Required. + :paramtype subnet_id: str + :keyword security_group_id: The resource ID of the security group. Any allowable/open ports + should be specified in the Network Security Group(NSG). + :paramtype security_group_id: str + """ + super().__init__(**kwargs) + self.subnet_id = subnet_id + self.security_group_id = security_group_id + + class OperationProperties(_serialization.Model): """Properties of the operation. @@ -3350,133 +4645,6 @@ def __init__( self.token = token -class ResourceModelWithAllowedPropertySetIdentity(Identity): # pylint: disable=name-too-long - """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. The value must be an UUID. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. The value must be an UUID. - :vartype tenant_id: str - :ivar type: The identity type. Default value is "SystemAssigned". - :vartype type: str - """ - - -class ResourceModelWithAllowedPropertySetPlan(Plan): - """ResourceModelWithAllowedPropertySetPlan. - - All required parameters must be populated in order to send to server. - - :ivar name: A user defined name of the 3rd Party Artifact that is being procured. Required. - :vartype name: str - :ivar publisher: The publisher of the 3rd Party Artifact that is being bought. E.g. NewRelic. - Required. - :vartype publisher: str - :ivar product: 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. Required. - :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 - """ - - -class Sku(_serialization.Model): - """The resource model definition representing SKU. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. - :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. Known values are: "Free", "Basic", - "Standard", and "Premium". - :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. - :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. - :vartype 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, - *, - name: str, - tier: Optional[Union[str, "_models.SkuTier"]] = None, - size: Optional[str] = None, - family: Optional[str] = None, - capacity: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. - :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. Known values are: "Free", "Basic", - "Standard", and "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().__init__(**kwargs) - self.name = name - self.tier = tier - self.size = size - self.family = family - self.capacity = capacity - - -class ResourceModelWithAllowedPropertySetSku(Sku): - """ResourceModelWithAllowedPropertySetSku. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. - :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. Known values are: "Free", "Basic", - "Standard", and "Premium". - :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. - :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. - :vartype capacity: int - """ - - class ResourceProviderOperation(_serialization.Model): """Supported operation of this resource provider. @@ -3664,13 +4832,12 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m 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 - :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 identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of scaling plan. (internal use). :vartype object_id: str :ivar description: Description of scaling plan. @@ -3679,7 +4846,7 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m :vartype friendly_name: str :ivar time_zone: Timezone of the scaling plan. Required. :vartype time_zone: str - :ivar host_pool_type: HostPool type for desktop. "Pooled" + :ivar host_pool_type: HostPool type for desktop. Known values are: "Pooled" and "Personal". :vartype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.ScalingHostPoolType :ivar exclusion_tag: Exclusion tag for scaling plan. :vartype exclusion_tag: str @@ -3712,9 +4879,9 @@ class ScalingPlan(ResourceModelWithAllowedPropertySet): # pylint: disable=too-m "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -3733,9 +4900,9 @@ def __init__( tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, host_pool_type: Union[str, "_models.ScalingHostPoolType"] = "Pooled", @@ -3758,21 +4925,19 @@ def __init__( 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 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 identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :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. Required. :paramtype time_zone: str - :keyword host_pool_type: HostPool type for desktop. "Pooled" + :keyword host_pool_type: HostPool type for desktop. Known values are: "Pooled" and "Personal". :paramtype host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.ScalingHostPoolType :keyword exclusion_tag: Exclusion tag for scaling plan. :paramtype exclusion_tag: str @@ -5102,43 +6267,125 @@ def __init__( self.off_peak_load_balancing_algorithm = off_peak_load_balancing_algorithm -class SendMessage(_serialization.Model): - """Represents message sent to a UserSession. +class SecurityInfoPatchProperties(_serialization.Model): + """Security information. - :ivar message_title: Title of message. - :vartype message_title: str - :ivar message_body: Body of message. - :vartype message_body: str + :ivar type: The security type used by virtual machine in hostpool session host. Known values + are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :ivar secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :vartype secure_boot_enabled: bool + :ivar v_tpm_enabled: Whether to use vTPM on the virtual machine. + :vartype v_tpm_enabled: bool """ _attribute_map = { - "message_title": {"key": "messageTitle", "type": "str"}, - "message_body": {"key": "messageBody", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, + "v_tpm_enabled": {"key": "vTpmEnabled", "type": "bool"}, } def __init__( - self, *, message_title: Optional[str] = None, message_body: Optional[str] = None, **kwargs: Any + self, + *, + type: Optional[Union[str, "_models.VirtualMachineSecurityType"]] = None, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs: Any ) -> None: """ - :keyword message_title: Title of message. - :paramtype message_title: str - :keyword message_body: Body of message. - :paramtype message_body: str + :keyword type: The security type used by virtual machine in hostpool session host. Known values + are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :keyword secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Whether to use vTPM on the virtual machine. + :paramtype v_tpm_enabled: bool """ super().__init__(**kwargs) - self.message_title = message_title - self.message_body = message_body + self.type = type + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled -class ServiceSpecification(_serialization.Model): - """Service specification payload. +class SecurityInfoProperties(_serialization.Model): + """Security information. - :ivar log_specifications: Specifications of the Log for Azure Monitoring. - :vartype log_specifications: list[~azure.mgmt.desktopvirtualization.models.LogSpecification] + :ivar type: The security type used by virtual machine in hostpool session host. Default is + Standard. Known values are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :vartype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :ivar secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :vartype secure_boot_enabled: bool + :ivar v_tpm_enabled: Whether to use vTPM on the virtual machine. + :vartype v_tpm_enabled: bool """ _attribute_map = { - "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, + "type": {"key": "type", "type": "str"}, + "secure_boot_enabled": {"key": "secureBootEnabled", "type": "bool"}, + "v_tpm_enabled": {"key": "vTpmEnabled", "type": "bool"}, + } + + def __init__( + self, + *, + type: Optional[Union[str, "_models.VirtualMachineSecurityType"]] = None, + secure_boot_enabled: Optional[bool] = None, + v_tpm_enabled: Optional[bool] = None, + **kwargs: Any + ) -> None: + """ + :keyword type: The security type used by virtual machine in hostpool session host. Default is + Standard. Known values are: "Standard", "TrustedLaunch", and "ConfidentialVM". + :paramtype type: str or ~azure.mgmt.desktopvirtualization.models.VirtualMachineSecurityType + :keyword secure_boot_enabled: Whether to use secureBoot on the virtual machine. + :paramtype secure_boot_enabled: bool + :keyword v_tpm_enabled: Whether to use vTPM on the virtual machine. + :paramtype v_tpm_enabled: bool + """ + super().__init__(**kwargs) + self.type = type + self.secure_boot_enabled = secure_boot_enabled + self.v_tpm_enabled = v_tpm_enabled + + +class SendMessage(_serialization.Model): + """Represents message sent to a UserSession. + + :ivar message_title: Title of message. + :vartype message_title: str + :ivar message_body: Body of message. + :vartype message_body: str + """ + + _attribute_map = { + "message_title": {"key": "messageTitle", "type": "str"}, + "message_body": {"key": "messageBody", "type": "str"}, + } + + def __init__( + self, *, message_title: Optional[str] = None, message_body: Optional[str] = None, **kwargs: Any + ) -> None: + """ + :keyword message_title: Title of message. + :paramtype message_title: str + :keyword message_body: Body of message. + :paramtype message_body: str + """ + super().__init__(**kwargs) + self.message_title = message_title + self.message_body = message_body + + +class ServiceSpecification(_serialization.Model): + """Service specification payload. + + :ivar log_specifications: Specifications of the Log for Azure Monitoring. + :vartype log_specifications: list[~azure.mgmt.desktopvirtualization.models.LogSpecification] + """ + + _attribute_map = { + "log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"}, } def __init__(self, *, log_specifications: Optional[List["_models.LogSpecification"]] = None, **kwargs: Any) -> None: @@ -5202,6 +6449,11 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes :vartype last_update_time: ~datetime.datetime :ivar update_error_message: The error message. :vartype update_error_message: str + :ivar last_session_host_update_time: The last time update was completed. + :vartype last_session_host_update_time: ~datetime.datetime + :ivar session_host_configuration: SessionHostConfiguration version reference at the time the + update is initiated, in the format of date time. Example: 2024-04-26T04:56:45Z. + :vartype session_host_configuration: str :ivar session_host_health_check_results: List of SessionHostHealthCheckReports. :vartype session_host_health_check_results: list[~azure.mgmt.desktopvirtualization.models.SessionHostHealthCheckReport] @@ -5217,6 +6469,8 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes "resource_id": {"readonly": True}, "status_timestamp": {"readonly": True}, "last_update_time": {"readonly": True}, + "last_session_host_update_time": {"readonly": True}, + "session_host_configuration": {"readonly": True}, "session_host_health_check_results": {"readonly": True}, } @@ -5241,6 +6495,8 @@ class SessionHost(Resource): # pylint: disable=too-many-instance-attributes "update_state": {"key": "properties.updateState", "type": "str"}, "last_update_time": {"key": "properties.lastUpdateTime", "type": "iso-8601"}, "update_error_message": {"key": "properties.updateErrorMessage", "type": "str"}, + "last_session_host_update_time": {"key": "properties.lastSessionHostUpdateTime", "type": "iso-8601"}, + "session_host_configuration": {"key": "properties.sessionHostConfiguration", "type": "str"}, "session_host_health_check_results": { "key": "properties.sessionHostHealthCheckResults", "type": "[SessionHostHealthCheckReport]", @@ -5308,9 +6564,488 @@ def __init__( self.update_state = update_state self.last_update_time = None self.update_error_message = update_error_message + self.last_session_host_update_time = None + self.session_host_configuration = None self.session_host_health_check_results = None +class SessionHostConfiguration(Resource): # pylint: disable=too-many-instance-attributes + """Represents a SessionHostConfiguration 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 server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar version: The timestamp of the last update. + :vartype version: ~datetime.datetime + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar provisioning_state: Provisioning state of the Session Host Configuration. Known values + are: "Succeeded", "Failed", "Canceled", and "Provisioning". + :vartype provisioning_state: str or + ~azure.mgmt.desktopvirtualization.models.ProvisioningStateSHC + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. It will default to the + location of the hostpool if not provided. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. Required. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. Required. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :vartype vm_size_id: str + :ivar disk_info: Disk information. Required. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. Required. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :ivar domain_info: Domain configurations of session hosts. Required. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. Required. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "version": {"readonly": True}, + "friendly_name": {"max_length": 260}, + "provisioning_state": {"readonly": True}, + "vm_name_prefix": {"required": True, "max_length": 11}, + "network_info": {"required": True}, + "vm_size_id": {"required": True}, + "disk_info": {"required": True}, + "image_info": {"required": True}, + "domain_info": {"required": True}, + "vm_admin_credentials": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "version": {"key": "properties.version", "type": "iso-8601"}, + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsProperties"}, + "boot_diagnostics_info": {"key": "properties.bootDiagnosticsInfo", "type": "BootDiagnosticsInfoProperties"}, + } + + def __init__( + self, + *, + vm_name_prefix: str, + network_info: "_models.NetworkInfoProperties", + vm_size_id: str, + disk_info: "_models.DiskInfoProperties", + image_info: "_models.ImageInfoProperties", + domain_info: "_models.DomainInfoProperties", + vm_admin_credentials: "_models.KeyVaultCredentialsProperties", + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + custom_configuration_script_url: Optional[str] = None, + security_info: Optional["_models.SecurityInfoProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. It will default to + the location of the hostpool if not provided. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + Required. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. Required. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. Required. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. Required. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. Required. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoProperties + :keyword domain_info: Domain configurations of session hosts. Required. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. Required. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoProperties + """ + super().__init__(**kwargs) + self.version = None + self.friendly_name = friendly_name + self.provisioning_state = None + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info + + +class SessionHostConfigurationList(_serialization.Model): + """List of SessionHostConfiguration definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SessionHostConfiguration definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :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": "[SessionHostConfiguration]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.SessionHostConfiguration"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of SessionHostConfiguration definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostConfigurationOperationStatus(_serialization.Model): + """The current status of an async operation. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Current defined values are . Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar operations: The operations list. + :vartype operations: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + + _validation = { + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "operations": {"key": "operations", "type": "[SessionHostConfigurationOperationStatus]"}, + "error": {"key": "error", "type": "ErrorDetail"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + operations: Optional[List["_models.SessionHostConfigurationOperationStatus"]] = None, + error: Optional["_models.ErrorDetail"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Current defined values are . Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword operations: The operations list. + :paramtype operations: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.operations = operations + self.error = error + + +class SessionHostConfigurationOperationStatusList(_serialization.Model): # pylint: disable=name-too-long + """List of OperationStatus definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of OperationStatus definitions. + :vartype value: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + :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": "[SessionHostConfigurationOperationStatus]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__( + self, *, value: Optional[List["_models.SessionHostConfigurationOperationStatus"]] = None, **kwargs: Any + ) -> None: + """ + :keyword value: List of OperationStatus definitions. + :paramtype value: + list[~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationOperationStatus] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostConfigurationPatch(_serialization.Model): # pylint: disable=too-many-instance-attributes + """Represents a SessionHostConfigurationPatch definition. + + :ivar friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :vartype friendly_name: str + :ivar vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :vartype vm_tags: dict[str, str] + :ivar vm_location: The Location for the session host to be created in. + :vartype vm_location: str + :ivar vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :vartype vm_resource_group: str + :ivar vm_name_prefix: The prefix that should be associated with session host names. + :vartype vm_name_prefix: str + :ivar availability_zones: Value for availability zones to be used by the session host. Should + be from [1,2,3]. + :vartype availability_zones: list[int] + :ivar network_info: Network information. + :vartype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoPatchProperties + :ivar vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. + :vartype vm_size_id: str + :ivar disk_info: Disk information. + :vartype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoPatchProperties + :ivar custom_configuration_script_url: The uri to the storage blob containing the arm template + to be run on the virtual machine after provisioning. + :vartype custom_configuration_script_url: str + :ivar image_info: Image configurations of HostPool. + :vartype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoPatchProperties + :ivar domain_info: Domain configurations of session hosts. + :vartype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoPatchProperties + :ivar security_info: Security information. + :vartype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoPatchProperties + :ivar vm_admin_credentials: Local Admin credentials for session hosts. + :vartype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + :ivar boot_diagnostics_info: Boot Diagnostics information. + :vartype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoPatchProperties + """ + + _validation = { + "friendly_name": {"max_length": 260}, + "vm_name_prefix": {"max_length": 11}, + "custom_configuration_script_url": {"max_length": 260}, + } + + _attribute_map = { + "friendly_name": {"key": "properties.friendlyName", "type": "str"}, + "vm_tags": {"key": "properties.vmTags", "type": "{str}"}, + "vm_location": {"key": "properties.vmLocation", "type": "str"}, + "vm_resource_group": {"key": "properties.vmResourceGroup", "type": "str"}, + "vm_name_prefix": {"key": "properties.vmNamePrefix", "type": "str"}, + "availability_zones": {"key": "properties.availabilityZones", "type": "[int]"}, + "network_info": {"key": "properties.networkInfo", "type": "NetworkInfoPatchProperties"}, + "vm_size_id": {"key": "properties.vmSizeId", "type": "str"}, + "disk_info": {"key": "properties.diskInfo", "type": "DiskInfoPatchProperties"}, + "custom_configuration_script_url": {"key": "properties.customConfigurationScriptUrl", "type": "str"}, + "image_info": {"key": "properties.imageInfo", "type": "ImageInfoPatchProperties"}, + "domain_info": {"key": "properties.domainInfo", "type": "DomainInfoPatchProperties"}, + "security_info": {"key": "properties.securityInfo", "type": "SecurityInfoPatchProperties"}, + "vm_admin_credentials": {"key": "properties.vmAdminCredentials", "type": "KeyVaultCredentialsPatchProperties"}, + "boot_diagnostics_info": { + "key": "properties.bootDiagnosticsInfo", + "type": "BootDiagnosticsInfoPatchProperties", + }, + } + + def __init__( + self, + *, + friendly_name: Optional[str] = None, + vm_tags: Optional[Dict[str, str]] = None, + vm_location: Optional[str] = None, + vm_resource_group: Optional[str] = None, + vm_name_prefix: Optional[str] = None, + availability_zones: Optional[List[int]] = None, + network_info: Optional["_models.NetworkInfoPatchProperties"] = None, + vm_size_id: Optional[str] = None, + disk_info: Optional["_models.DiskInfoPatchProperties"] = None, + custom_configuration_script_url: Optional[str] = None, + image_info: Optional["_models.ImageInfoPatchProperties"] = None, + domain_info: Optional["_models.DomainInfoPatchProperties"] = None, + security_info: Optional["_models.SecurityInfoPatchProperties"] = None, + vm_admin_credentials: Optional["_models.KeyVaultCredentialsPatchProperties"] = None, + boot_diagnostics_info: Optional["_models.BootDiagnosticsInfoPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword friendly_name: Friendly name to describe this version of the SessionHostConfiguration. + :paramtype friendly_name: str + :keyword vm_tags: Hashtable that lists key/value pair tags to apply to the VMs. + :paramtype vm_tags: dict[str, str] + :keyword vm_location: The Location for the session host to be created in. + :paramtype vm_location: str + :keyword vm_resource_group: The ResourceGroup for the session hosts to be created in. It will + default to the ResourceGroup of the hostpool if not provided. + :paramtype vm_resource_group: str + :keyword vm_name_prefix: The prefix that should be associated with session host names. + :paramtype vm_name_prefix: str + :keyword availability_zones: Value for availability zones to be used by the session host. + Should be from [1,2,3]. + :paramtype availability_zones: list[int] + :keyword network_info: Network information. + :paramtype network_info: ~azure.mgmt.desktopvirtualization.models.NetworkInfoPatchProperties + :keyword vm_size_id: The id of the size of a virtual machine connected to a hostpool. Example: + Standard_D2as_v6. + :paramtype vm_size_id: str + :keyword disk_info: Disk information. + :paramtype disk_info: ~azure.mgmt.desktopvirtualization.models.DiskInfoPatchProperties + :keyword custom_configuration_script_url: The uri to the storage blob containing the arm + template to be run on the virtual machine after provisioning. + :paramtype custom_configuration_script_url: str + :keyword image_info: Image configurations of HostPool. + :paramtype image_info: ~azure.mgmt.desktopvirtualization.models.ImageInfoPatchProperties + :keyword domain_info: Domain configurations of session hosts. + :paramtype domain_info: ~azure.mgmt.desktopvirtualization.models.DomainInfoPatchProperties + :keyword security_info: Security information. + :paramtype security_info: ~azure.mgmt.desktopvirtualization.models.SecurityInfoPatchProperties + :keyword vm_admin_credentials: Local Admin credentials for session hosts. + :paramtype vm_admin_credentials: + ~azure.mgmt.desktopvirtualization.models.KeyVaultCredentialsPatchProperties + :keyword boot_diagnostics_info: Boot Diagnostics information. + :paramtype boot_diagnostics_info: + ~azure.mgmt.desktopvirtualization.models.BootDiagnosticsInfoPatchProperties + """ + super().__init__(**kwargs) + self.friendly_name = friendly_name + self.vm_tags = vm_tags + self.vm_location = vm_location + self.vm_resource_group = vm_resource_group + self.vm_name_prefix = vm_name_prefix + self.availability_zones = availability_zones + self.network_info = network_info + self.vm_size_id = vm_size_id + self.disk_info = disk_info + self.custom_configuration_script_url = custom_configuration_script_url + self.image_info = image_info + self.domain_info = domain_info + self.security_info = security_info + self.vm_admin_credentials = vm_admin_credentials + self.boot_diagnostics_info = boot_diagnostics_info + + class SessionHostHealthCheckFailureDetails(_serialization.Model): """Contains details on the failure. @@ -5416,6 +7151,306 @@ def __init__(self, *, value: Optional[List["_models.SessionHost"]] = None, **kwa self.next_link = None +class SessionHostManagement(ProxyResource): + """Represents a SessionHostManagement 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 server. + + :ivar id: Fully qualified resource ID for the resource. E.g. + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". # pylint: disable=line-too-long + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.desktopvirtualization.models.SystemData + :ivar scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. Required. + :vartype scheduled_date_time_zone: str + :ivar update: Parameters for a hostpool update. Required. + :vartype update: ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationProperties + """ + + _validation = { + "id": {"readonly": True}, + "name": {"readonly": True}, + "type": {"readonly": True}, + "system_data": {"readonly": True}, + "scheduled_date_time_zone": {"required": True}, + "update": {"required": True}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "type": {"key": "type", "type": "str"}, + "system_data": {"key": "systemData", "type": "SystemData"}, + "scheduled_date_time_zone": {"key": "properties.scheduledDateTimeZone", "type": "str"}, + "update": {"key": "properties.update", "type": "HostPoolUpdateConfigurationProperties"}, + } + + def __init__( + self, *, scheduled_date_time_zone: str, update: "_models.HostPoolUpdateConfigurationProperties", **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. Required. + :paramtype scheduled_date_time_zone: str + :keyword update: Parameters for a hostpool update. Required. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationProperties + """ + super().__init__(**kwargs) + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class SessionHostManagementList(_serialization.Model): + """List of SessionHostManagement definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of SessionHostManagement definitions. + :vartype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :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": "[SessionHostManagement]"}, + "next_link": {"key": "nextLink", "type": "str"}, + } + + def __init__(self, *, value: Optional[List["_models.SessionHostManagement"]] = None, **kwargs: Any) -> None: + """ + :keyword value: List of SessionHostManagement definitions. + :paramtype value: list[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + """ + super().__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostManagementOperationProgress(_serialization.Model): + """SessionHostManagement Operation Progress information. + + :ivar execution_start_time: Time that the sessionHostManagement operation was created. + :vartype execution_start_time: ~datetime.datetime + :ivar total_session_hosts: The number of sessionHosts to be started in the + sessionHostManagement operation. + :vartype total_session_hosts: int + :ivar session_hosts_in_progress: The number of sessionHosts in progress in the + sessionHostManagement operation. + :vartype session_hosts_in_progress: int + :ivar session_hosts_completed: The number of sessionHosts completed in the + sessionHostManagement operation. + :vartype session_hosts_completed: int + :ivar session_hosts_rollback_failed: The number of sessionHosts rollback failed in the + sessionHostManagement operation. + :vartype session_hosts_rollback_failed: int + """ + + _attribute_map = { + "execution_start_time": {"key": "executionStartTime", "type": "iso-8601"}, + "total_session_hosts": {"key": "totalSessionHosts", "type": "int"}, + "session_hosts_in_progress": {"key": "sessionHostsInProgress", "type": "int"}, + "session_hosts_completed": {"key": "sessionHostsCompleted", "type": "int"}, + "session_hosts_rollback_failed": {"key": "sessionHostsRollbackFailed", "type": "int"}, + } + + def __init__( + self, + *, + execution_start_time: Optional[datetime.datetime] = None, + total_session_hosts: Optional[int] = None, + session_hosts_in_progress: Optional[int] = None, + session_hosts_completed: Optional[int] = None, + session_hosts_rollback_failed: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword execution_start_time: Time that the sessionHostManagement operation was created. + :paramtype execution_start_time: ~datetime.datetime + :keyword total_session_hosts: The number of sessionHosts to be started in the + sessionHostManagement operation. + :paramtype total_session_hosts: int + :keyword session_hosts_in_progress: The number of sessionHosts in progress in the + sessionHostManagement operation. + :paramtype session_hosts_in_progress: int + :keyword session_hosts_completed: The number of sessionHosts completed in the + sessionHostManagement operation. + :paramtype session_hosts_completed: int + :keyword session_hosts_rollback_failed: The number of sessionHosts rollback failed in the + sessionHostManagement operation. + :paramtype session_hosts_rollback_failed: int + """ + super().__init__(**kwargs) + self.execution_start_time = execution_start_time + self.total_session_hosts = total_session_hosts + self.session_hosts_in_progress = session_hosts_in_progress + self.session_hosts_completed = session_hosts_completed + self.session_hosts_rollback_failed = session_hosts_rollback_failed + + +class SessionHostManagementPatch(_serialization.Model): + """Represents a SessionHostManagementPatch definition. + + :ivar scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. + :vartype scheduled_date_time_zone: str + :ivar update: Parameters for a hostpool update. + :vartype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + + _attribute_map = { + "scheduled_date_time_zone": {"key": "properties.scheduledDateTimeZone", "type": "str"}, + "update": {"key": "properties.update", "type": "HostPoolUpdateConfigurationPatchProperties"}, + } + + def __init__( + self, + *, + scheduled_date_time_zone: Optional[str] = None, + update: Optional["_models.HostPoolUpdateConfigurationPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time_zone: Time zone for sessionHostManagement operations as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. Must be set + if useLocalTime is true. + :paramtype scheduled_date_time_zone: str + :keyword update: Parameters for a hostpool update. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + super().__init__(**kwargs) + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class SessionHostManagementUpdateStatus(_serialization.Model): # pylint: disable=too-many-instance-attributes + """The current status of the session host update async operation. + + All required parameters must be populated in order to send to server. + + :ivar id: Fully qualified ID for the async operation. + :vartype id: str + :ivar name: Name of the async operation. + :vartype name: str + :ivar status: Operation status. Current defined values are < Error | Scheduled | + UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | + Succeeded | Failed | Canceled. Required. + :vartype status: str + :ivar percent_complete: Percent of the operation that is complete. + :vartype percent_complete: float + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar error: If present, details of the operation error. + :vartype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + :ivar correlation_id: The Log Analytics. + :vartype correlation_id: str + :ivar progress: Progress information on the sessionHostManagement operation. + :vartype progress: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationProgress + :ivar scheduled_date_time: The timestamp that the update is scheduled for. + :vartype scheduled_date_time: ~datetime.datetime + :ivar session_host_management: SessionHostManagement properties used for the operation. + :vartype session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + """ + + _validation = { + "status": {"required": True}, + "percent_complete": {"maximum": 100, "minimum": 0}, + } + + _attribute_map = { + "id": {"key": "id", "type": "str"}, + "name": {"key": "name", "type": "str"}, + "status": {"key": "status", "type": "str"}, + "percent_complete": {"key": "percentComplete", "type": "float"}, + "start_time": {"key": "startTime", "type": "iso-8601"}, + "end_time": {"key": "endTime", "type": "iso-8601"}, + "error": {"key": "error", "type": "ErrorDetail"}, + "correlation_id": {"key": "properties.correlationId", "type": "str"}, + "progress": {"key": "properties.progress", "type": "SessionHostManagementOperationProgress"}, + "scheduled_date_time": {"key": "properties.scheduledDateTime", "type": "iso-8601"}, + "session_host_management": {"key": "properties.sessionHostManagement", "type": "SessionHostManagement"}, + } + + def __init__( + self, + *, + status: str, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + percent_complete: Optional[float] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + error: Optional["_models.ErrorDetail"] = None, + correlation_id: Optional[str] = None, + progress: Optional["_models.SessionHostManagementOperationProgress"] = None, + scheduled_date_time: Optional[datetime.datetime] = None, + session_host_management: Optional["_models.SessionHostManagement"] = None, + **kwargs: Any + ) -> None: + """ + :keyword id: Fully qualified ID for the async operation. + :paramtype id: str + :keyword name: Name of the async operation. + :paramtype name: str + :keyword status: Operation status. Current defined values are < Error | Scheduled | + UpdatingSessionHosts | ValidatingSessionHostUpdate | Paused | Pausing | Cancelling > | + Succeeded | Failed | Canceled. Required. + :paramtype status: str + :keyword percent_complete: Percent of the operation that is complete. + :paramtype percent_complete: float + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword error: If present, details of the operation error. + :paramtype error: ~azure.mgmt.desktopvirtualization.models.ErrorDetail + :keyword correlation_id: The Log Analytics. + :paramtype correlation_id: str + :keyword progress: Progress information on the sessionHostManagement operation. + :paramtype progress: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementOperationProgress + :keyword scheduled_date_time: The timestamp that the update is scheduled for. + :paramtype scheduled_date_time: ~datetime.datetime + :keyword session_host_management: SessionHostManagement properties used for the operation. + :paramtype session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + """ + super().__init__(**kwargs) + self.id = id + self.name = name + self.status = status + self.percent_complete = percent_complete + self.start_time = start_time + self.end_time = end_time + self.error = error + self.correlation_id = correlation_id + self.progress = progress + self.scheduled_date_time = scheduled_date_time + self.session_host_management = session_host_management + + class SessionHostPatch(Resource): """SessionHost properties that can be patched. @@ -5479,6 +7514,75 @@ def __init__( self.friendly_name = friendly_name +class Sku(_serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to server. + + :ivar name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :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. Known values are: "Free", "Basic", + "Standard", and "Premium". + :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. + :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. + :vartype 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, + *, + name: str, + tier: Optional[Union[str, "_models.SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs: Any + ) -> None: + """ + :keyword name: The name of the SKU. E.g. P3. It is typically a letter+number code. Required. + :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. Known values are: "Free", "Basic", + "Standard", and "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().__init__(**kwargs) + self.name = name + self.tier = tier + self.size = size + self.family = family + self.capacity = capacity + + class StartMenuItem(Resource): """Represents a StartMenuItem definition. @@ -5683,6 +7787,81 @@ def __init__(self, *, hour: int, minute: int, **kwargs: Any) -> None: self.minute = minute +class UpdateSessionHostsRequestBody(_serialization.Model): + """Object containing the definition for properties to be used for a sessionHostUpdate operation. + + :ivar scheduled_date_time: The timestamp that the update validation is scheduled for. If none + is provided, the update will be executed immediately. + :vartype scheduled_date_time: ~datetime.datetime + :ivar scheduled_date_time_zone: The timeZone as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + :vartype scheduled_date_time_zone: str + :ivar update: settings for management information for the hostpool update operation. If none is + provided the update will use the settings saved in the sessionHostManagement object. + :vartype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + + _attribute_map = { + "scheduled_date_time": {"key": "scheduledDateTime", "type": "iso-8601"}, + "scheduled_date_time_zone": {"key": "scheduledDateTimeZone", "type": "str"}, + "update": {"key": "update", "type": "HostPoolUpdateConfigurationPatchProperties"}, + } + + def __init__( + self, + *, + scheduled_date_time: Optional[datetime.datetime] = None, + scheduled_date_time_zone: Optional[str] = None, + update: Optional["_models.HostPoolUpdateConfigurationPatchProperties"] = None, + **kwargs: Any + ) -> None: + """ + :keyword scheduled_date_time: The timestamp that the update validation is scheduled for. If + none is provided, the update will be executed immediately. + :paramtype scheduled_date_time: ~datetime.datetime + :keyword scheduled_date_time_zone: The timeZone as defined in + https://docs.microsoft.com/dotnet/api/system.timezoneinfo.findsystemtimezonebyid. + :paramtype scheduled_date_time_zone: str + :keyword update: settings for management information for the hostpool update operation. If none + is provided the update will use the settings saved in the sessionHostManagement object. + :paramtype update: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateConfigurationPatchProperties + """ + super().__init__(**kwargs) + self.scheduled_date_time = scheduled_date_time + self.scheduled_date_time_zone = scheduled_date_time_zone + self.update = update + + +class UserAssignedIdentity(_serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + "principal_id": {"readonly": True}, + "client_id": {"readonly": True}, + } + + _attribute_map = { + "principal_id": {"key": "principalId", "type": "str"}, + "client_id": {"key": "clientId", "type": "str"}, + } + + def __init__(self, **kwargs: Any) -> None: + """ """ + super().__init__(**kwargs) + self.principal_id = None + self.client_id = None + + class UserSession(Resource): """Represents a UserSession definition. @@ -5836,13 +8015,12 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man 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 - :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 identity: Managed service identity (system assigned and/or user assigned identities). + :vartype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :ivar sku: The resource model definition representing SKU. + :vartype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :ivar plan: Plan for the resource. + :vartype plan: ~azure.mgmt.desktopvirtualization.models.Plan :ivar object_id: ObjectId of Workspace. (internal use). :vartype object_id: str :ivar description: Description of Workspace. @@ -5887,9 +8065,9 @@ class Workspace(ResourceModelWithAllowedPropertySet): # pylint: disable=too-man "managed_by": {"key": "managedBy", "type": "str"}, "kind": {"key": "kind", "type": "str"}, "etag": {"key": "etag", "type": "str"}, - "identity": {"key": "identity", "type": "ResourceModelWithAllowedPropertySetIdentity"}, - "sku": {"key": "sku", "type": "ResourceModelWithAllowedPropertySetSku"}, - "plan": {"key": "plan", "type": "ResourceModelWithAllowedPropertySetPlan"}, + "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, + "sku": {"key": "sku", "type": "Sku"}, + "plan": {"key": "plan", "type": "Plan"}, "object_id": {"key": "properties.objectId", "type": "str"}, "description": {"key": "properties.description", "type": "str"}, "friendly_name": {"key": "properties.friendlyName", "type": "str"}, @@ -5909,9 +8087,9 @@ def __init__( tags: Optional[Dict[str, str]] = None, managed_by: Optional[str] = None, kind: Optional[str] = None, - identity: Optional["_models.ResourceModelWithAllowedPropertySetIdentity"] = None, - sku: Optional["_models.ResourceModelWithAllowedPropertySetSku"] = None, - plan: Optional["_models.ResourceModelWithAllowedPropertySetPlan"] = None, + identity: Optional["_models.ManagedServiceIdentity"] = None, + sku: Optional["_models.Sku"] = None, + plan: Optional["_models.Plan"] = None, description: Optional[str] = None, friendly_name: Optional[str] = None, application_group_references: Optional[List[str]] = None, @@ -5932,14 +8110,12 @@ def __init__( 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 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 identity: Managed service identity (system assigned and/or user assigned identities). + :paramtype identity: ~azure.mgmt.desktopvirtualization.models.ManagedServiceIdentity + :keyword sku: The resource model definition representing SKU. + :paramtype sku: ~azure.mgmt.desktopvirtualization.models.Sku + :keyword plan: Plan for the resource. + :paramtype plan: ~azure.mgmt.desktopvirtualization.models.Plan :keyword description: Description of Workspace. :paramtype description: str :keyword friendly_name: Friendly name of Workspace. diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py index df927dd95440..8ea21f89ab23 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py @@ -18,8 +18,15 @@ from ._applications_operations import ApplicationsOperations from ._desktops_operations import DesktopsOperations from ._host_pools_operations import HostPoolsOperations +from ._session_host_managements_operations import SessionHostManagementsOperations +from ._initiate_session_host_update_operations import InitiateSessionHostUpdateOperations +from ._control_session_host_update_operations import ControlSessionHostUpdateOperations +from ._session_host_managements_update_status_operations import SessionHostManagementsUpdateStatusOperations +from ._session_host_configurations_operations import SessionHostConfigurationsOperations +from ._active_session_host_configurations_operations import ActiveSessionHostConfigurationsOperations from ._user_sessions_operations import UserSessionsOperations from ._session_hosts_operations import SessionHostsOperations +from ._session_host_operations import SessionHostOperations from ._msix_packages_operations import MSIXPackagesOperations from ._app_attach_package_info_operations import AppAttachPackageInfoOperations from ._msix_images_operations import MsixImagesOperations @@ -42,8 +49,15 @@ "ApplicationsOperations", "DesktopsOperations", "HostPoolsOperations", + "SessionHostManagementsOperations", + "InitiateSessionHostUpdateOperations", + "ControlSessionHostUpdateOperations", + "SessionHostManagementsUpdateStatusOperations", + "SessionHostConfigurationsOperations", + "ActiveSessionHostConfigurationsOperations", "UserSessionsOperations", "SessionHostsOperations", + "SessionHostOperations", "MSIXPackagesOperations", "AppAttachPackageInfoOperations", "MsixImagesOperations", diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..4b53203aa8d2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_active_session_host_configurations_operations.py @@ -0,0 +1,272 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_host_pool_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/activeSessionHostConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class ActiveSessionHostConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`active_session_host_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.ActiveSessionHostConfiguration: + """Get the ActiveSessionHostConfiguration for the hostPool that is currently being used for update + operations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: ActiveSessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActiveSessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("ActiveSessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.ActiveSessionHostConfiguration"]: + """List activeSessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either ActiveSessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.ActiveSessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.ActiveSessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ActiveSessionHostConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py index 077e07be9440..4182f445de4d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_info_operations.py @@ -46,7 +46,7 @@ def build_import_method_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py index a6b06fb591c3..ee30ca7dfdab 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_app_attach_package_operations.py @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -124,12 +124,17 @@ def build_create_or_update_request( def build_delete_request( - resource_group_name: str, app_attach_package_name: str, subscription_id: str, **kwargs: Any + resource_group_name: str, + app_attach_package_name: str, + subscription_id: str, + *, + force: Optional[bool] = None, + **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,6 +161,8 @@ def build_delete_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if force is not None: + _params["force"] = _SERIALIZER.query("force", force, "bool") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -169,7 +176,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -212,7 +219,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +253,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -296,7 +303,7 @@ def get(self, resource_group_name: str, app_attach_package_name: str, **kwargs: :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :return: AppAttachPackage or the result of cls(response) :rtype: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage @@ -360,7 +367,7 @@ def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package: Object containing App Attach Package definitions. Required. :type app_attach_package: ~azure.mgmt.desktopvirtualization.models.AppAttachPackage @@ -387,7 +394,7 @@ def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package: Object containing App Attach Package definitions. Required. :type app_attach_package: IO[bytes] @@ -412,7 +419,7 @@ def create_or_update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package: Object containing App Attach Package definitions. Is either a AppAttachPackage type or a IO[bytes] type. Required. @@ -479,15 +486,17 @@ def create_or_update( @distributed_trace def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, app_attach_package_name: str, **kwargs: Any + self, resource_group_name: str, app_attach_package_name: str, force: Optional[bool] = None, **kwargs: Any ) -> None: """Remove an App Attach Package. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str + :param force: Force flag to delete App Attach package. Default value is None. + :type force: bool :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: @@ -510,6 +519,7 @@ def delete( # pylint: disable=inconsistent-return-statements resource_group_name=resource_group_name, app_attach_package_name=app_attach_package_name, subscription_id=self._config.subscription_id, + force=force, api_version=api_version, headers=_headers, params=_params, @@ -546,7 +556,7 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package_patch: Object containing App Attach Package definition. Default value is None. @@ -574,7 +584,7 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package_patch: Object containing App Attach Package definition. Default value is None. @@ -600,7 +610,7 @@ def update( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param app_attach_package_name: The name of the App Attach package. Required. + :param app_attach_package_name: The name of the App Attach package arm object. Required. :type app_attach_package_name: str :param app_attach_package_patch: Object containing App Attach Package definition. Is either a AppAttachPackagePatch type or a IO[bytes] type. Default value is None. @@ -677,8 +687,8 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str - :param filter: OData filter expression. Valid properties for filtering are package name and - host pool. Default value is None. + :param filter: OData filter expression. Valid properties for filtering are package name, host + pool, package owner name, and custom data. Default value is None. :type filter: str :return: An iterator like instance of either AppAttachPackage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] @@ -757,8 +767,8 @@ def get_next(next_link=None): def list_by_subscription(self, filter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.AppAttachPackage"]: """List App Attach packages in subscription. - :param filter: OData filter expression. Valid properties for filtering are package name, host - pool, and resource group. Default value is None. + :param filter: OData filter expression. Valid properties for filtering are package name, + resource group, host pool, package owner name, and custom data. Default value is None. :type filter: str :return: An iterator like instance of either AppAttachPackage or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.AppAttachPackage] 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 870748fdddd9..422b4ae7488f 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -86,7 +86,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -129,7 +129,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +169,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -219,7 +219,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -259,7 +259,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 0d9e753eab88..fdb53f5fa4c7 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +135,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +178,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -231,7 +231,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py new file mode 100644 index 000000000000..d5cdfb841805 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_control_session_host_update_operations.py @@ -0,0 +1,296 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterator, Optional, Type, TypeVar, Union, cast, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/controlSessionHostUpdate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class ControlSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`control_session_host_update` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _post_initial( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(host_pool_update_control_parameter, (IOBase, bytes)): + _content = host_pool_update_control_parameter + else: + _json = self._serialize.body(host_pool_update_control_parameter, "HostPoolUpdateControlParameter") + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: _models.HostPoolUpdateControlParameter, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Required. + :type host_pool_update_control_parameter: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_post( + self, + resource_group_name: str, + host_pool_name: str, + host_pool_update_control_parameter: Union[_models.HostPoolUpdateControlParameter, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Control update of a hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param host_pool_update_control_parameter: Object containing control action for hostpool + update. Is either a HostPoolUpdateControlParameter type or a IO[bytes] type. Required. + :type host_pool_update_control_parameter: + ~azure.mgmt.desktopvirtualization.models.HostPoolUpdateControlParameter or IO[bytes] + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._post_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + host_pool_update_control_parameter=host_pool_update_control_parameter, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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 7504de7951ce..5015679a561b 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -142,7 +142,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 fbd4a0b1da44..eb2d3abe0403 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -119,7 +119,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -156,7 +156,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -200,7 +200,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -243,7 +243,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -277,7 +277,7 @@ def build_retrieve_registration_token_request( # pylint: disable=name-too-long _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -312,7 +312,7 @@ def build_list_registration_tokens_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..042ccb5aa160 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_initiate_session_host_update_operations.py @@ -0,0 +1,231 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Optional, Type, TypeVar, Union, overload + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_post_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/initiateSessionHostUpdate", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class InitiateSessionHostUpdateOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`initiate_session_host_update` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @overload + def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[_models.UpdateSessionHostsRequestBody] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Default value is None. + :type update_session_hosts_request_body: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def post( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + host_pool_name: str, + update_session_hosts_request_body: Optional[Union[_models.UpdateSessionHostsRequestBody, IO[bytes]]] = None, + **kwargs: Any + ) -> None: + """Initiates a hostpool update or schedule an update for the future. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param update_session_hosts_request_body: Object containing the definition for properties to be + used in the sessionHostUpdate validation. Is either a UpdateSessionHostsRequestBody type or a + IO[bytes] type. Default value is None. + :type update_session_hosts_request_body: + ~azure.mgmt.desktopvirtualization.models.UpdateSessionHostsRequestBody or IO[bytes] + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(update_session_hosts_request_body, (IOBase, bytes)): + _content = update_session_hosts_request_body + else: + if update_session_hosts_request_body is not None: + _json = self._serialize.body(update_session_hosts_request_body, "UpdateSessionHostsRequestBody") + else: + _json = None + + _request = build_post_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # 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 a602ef61d945..f5c8ad839cc2 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 @@ -46,7 +46,7 @@ def build_expand_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") 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 645fa353dc5c..e2fb23d60dd8 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -89,7 +89,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -135,7 +135,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -178,7 +178,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -231,7 +231,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 066c8cf26276..5921394e571a 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 @@ -43,7 +43,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 723ac5e2b192..527b4fd0fc4d 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 @@ -46,7 +46,7 @@ def build_list_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -127,7 +127,7 @@ def build_delete_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -169,7 +169,7 @@ def build_update_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -217,7 +217,7 @@ def build_list_by_host_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -262,7 +262,7 @@ def build_get_by_host_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -304,7 +304,7 @@ def build_delete_by_host_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -346,7 +346,7 @@ def build_update_by_host_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") 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 29d187f3a69e..206ba6d979ca 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 @@ -52,7 +52,7 @@ def build_list_by_workspace_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -100,7 +100,7 @@ def build_list_by_host_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py index a28ff48dc5a4..d909d627643f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_personal_schedules_operations.py @@ -50,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +194,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -247,7 +247,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py index 272f08869c78..6aad6bab3830 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plan_pooled_schedules_operations.py @@ -50,7 +50,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -97,7 +97,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -147,7 +147,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -194,7 +194,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -247,7 +247,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 96cb4dae6d9d..1cd50b6a0847 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_create_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -119,7 +119,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,7 +198,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -241,7 +241,7 @@ def build_list_by_subscription_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -282,7 +282,7 @@ def build_list_by_host_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py new file mode 100644 index 000000000000..31d46913343a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_configurations_operations.py @@ -0,0 +1,787 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_create_or_update_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_get_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_host_pool_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostConfigurations", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SessionHostConfigurationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_configurations` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + def _create_or_update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + _json = self._serialize.body(session_host_configuration, "SessionHostConfiguration") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: _models.SessionHostConfiguration, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Required. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Union[_models.SessionHostConfiguration, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Create or update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfiguration type or a IO[bytes] type. Required. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration or IO[bytes] + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_configuration, (IOBase, bytes)): + _content = session_host_configuration + else: + if session_host_configuration is not None: + _json = self._serialize.body(session_host_configuration, "SessionHostConfigurationPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 200: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[_models.SessionHostConfigurationPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. + Default value is None. + :type session_host_configuration: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_configuration: Optional[Union[_models.SessionHostConfigurationPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> LROPoller[_models.SessionHostConfiguration]: + """Update a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_configuration: Object containing SessionHostConfiguration definitions. Is + either a SessionHostConfigurationPatch type or a IO[bytes] type. Default value is None. + :type session_host_configuration: + ~azure.mgmt.desktopvirtualization.models.SessionHostConfigurationPatch or IO[bytes] + :return: An instance of LROPoller that returns either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_configuration=session_host_configuration, + api_version=api_version, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.SessionHostConfiguration].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SessionHostConfiguration]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.SessionHostConfiguration: + """Get a SessionHostConfiguration. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostConfiguration or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostConfiguration] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostConfiguration", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.SessionHostConfiguration"]: + """List sessionHostConfigurations. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostConfiguration or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostConfigurationList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostConfigurationList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py new file mode 100644 index 000000000000..fd9069dc809a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_operations.py @@ -0,0 +1,614 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from io import IOBase +import sys +from typing import Any, Callable, Dict, IO, Iterable, Optional, Type, TypeVar, Union, overload +import urllib.parse + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_create_or_update_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_update_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_list_by_host_pool_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SessionHostManagementsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, host_pool_name: str, **kwargs: Any) -> _models.SessionHostManagement: + """Get a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: _models.SessionHostManagement, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Required. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Union[_models.SessionHostManagement, IO[bytes]], + **kwargs: Any + ) -> _models.SessionHostManagement: + """Create or update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagement type or a IO[bytes] type. Required. + :type session_host_management: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + _json = self._serialize.body(session_host_management, "SessionHostManagement") + + _request = build_create_or_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[_models.SessionHostManagementPatch] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[IO[bytes]] = None, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Default + value is None. + :type session_host_management: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_management: Optional[Union[_models.SessionHostManagementPatch, IO[bytes]]] = None, + **kwargs: Any + ) -> _models.SessionHostManagement: + """Update a SessionHostManagement. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_management: Object containing SessionHostManagement definitions. Is either + a SessionHostManagementPatch type or a IO[bytes] type. Default value is None. + :type session_host_management: + ~azure.mgmt.desktopvirtualization.models.SessionHostManagementPatch or IO[bytes] + :return: SessionHostManagement or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagement + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.SessionHostManagement] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _json = None + _content = None + if isinstance(session_host_management, (IOBase, bytes)): + _content = session_host_management + else: + if session_host_management is not None: + _json = self._serialize.body(session_host_management, "SessionHostManagementPatch") + else: + _json = None + + _request = build_update_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + content=_content, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagement", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_host_pool( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> Iterable["_models.SessionHostManagement"]: + """List SessionHostManagements by hostPool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: An iterator like instance of either SessionHostManagement or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHostManagement] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagementList] = kwargs.pop("cls", None) + + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_list_by_host_pool_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + _request.url = self._client.format_url(_request.url) + _request.method = "GET" + return _request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SessionHostManagementList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py new file mode 100644 index 000000000000..108c0ae4d091 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_managements_update_status_operations.py @@ -0,0 +1,150 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_get_request( + resource_group_name: str, host_pool_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHostManagements/default/sessionHostUpdateStatuses/default", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +class SessionHostManagementsUpdateStatusOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host_managements_update_status` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, host_pool_name: str, **kwargs: Any + ) -> _models.SessionHostManagementUpdateStatus: + """Get the session host update status for a given hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :return: SessionHostManagementUpdateStatus or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostManagementUpdateStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[_models.SessionHostManagementUpdateStatus] = kwargs.pop("cls", None) + + _request = build_get_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize("SessionHostManagementUpdateStatus", pipeline_response.http_response) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py new file mode 100644 index 000000000000..93748748a980 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_host_operations.py @@ -0,0 +1,152 @@ +# pylint: disable=too-many-lines,too-many-statements +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import sys +from typing import Any, Callable, Dict, Optional, Type, TypeVar + +from azure.core.exceptions import ( + ClientAuthenticationError, + HttpResponseError, + ResourceExistsError, + ResourceNotFoundError, + ResourceNotModifiedError, + map_error, +) +from azure.core.pipeline import PipelineResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._serialization import Serializer + +if sys.version_info >= (3, 9): + from collections.abc import MutableMapping +else: + from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports +T = TypeVar("T") +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + + +def build_retry_provisioning_request( + resource_group_name: str, host_pool_name: str, session_host_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = kwargs.pop( + "template_url", + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/retryProvisioning", + ) # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url( + "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 + ), + "hostPoolName": _SERIALIZER.url( + "host_pool_name", host_pool_name, "str", max_length=64, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + "sessionHostName": _SERIALIZER.url( + "session_host_name", session_host_name, "str", max_length=48, min_length=3, pattern=r"^[A-Za-z0-9@.\-_ ]*$" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +class SessionHostOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.desktopvirtualization.DesktopVirtualizationMgmtClient`'s + :attr:`session_host` attribute. + """ + + models = _models + + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def retry_provisioning( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, host_pool_name: str, session_host_name: str, **kwargs: Any + ) -> None: + """Retry provisioning on a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. Required. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + Required. + :type session_host_name: str + :return: None or the result of cls(response) + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_retry_provisioning_request( + resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + session_host_name=session_host_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # 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 a13604cb1569..4d7ddf509e6b 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -90,7 +90,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -136,7 +136,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -181,12 +181,13 @@ def build_list_request( page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, + vm_path: Optional[str] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -214,6 +215,10 @@ def build_list_request( _params["isDescending"] = _SERIALIZER.query("is_descending", is_descending, "bool") if initial_skip is not None: _params["initialSkip"] = _SERIALIZER.query("initial_skip", initial_skip, "int") + if vm_path is not None: + _params["vmPath"] = _SERIALIZER.query( + "vm_path", vm_path, "str", max_length=1092, min_length=3, pattern=r"^[A-Z][a-z][0-9][@./-_ ]*$" + ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -534,6 +539,7 @@ def list( page_size: Optional[int] = None, is_descending: Optional[bool] = None, initial_skip: Optional[int] = None, + vm_path: Optional[str] = None, **kwargs: Any ) -> Iterable["_models.SessionHost"]: """List sessionHosts. @@ -549,6 +555,8 @@ def list( :type is_descending: bool :param initial_skip: Initial number of items to skip. Default value is None. :type initial_skip: int + :param vm_path: The path to the VM. Default value is None. + :type vm_path: str :return: An iterator like instance of either SessionHost or the result of cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.desktopvirtualization.models.SessionHost] :raises ~azure.core.exceptions.HttpResponseError: @@ -577,6 +585,7 @@ def prepare_request(next_link=None): page_size=page_size, is_descending=is_descending, initial_skip=initial_skip, + vm_path=vm_path, api_version=api_version, headers=_headers, params=_params, 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 5ff91168d267..bc888839e4e1 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 @@ -52,7 +52,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL 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 a551f43645f9..78f5f33bf284 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 @@ -54,7 +54,7 @@ def build_list_by_host_pool_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -148,7 +148,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -197,7 +197,7 @@ def build_list_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -246,7 +246,7 @@ def build_disconnect_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -290,7 +290,7 @@ def build_send_message_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") 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 94b8a7955f8e..f8b0d9e9c584 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 @@ -46,7 +46,7 @@ def build_get_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -81,7 +81,7 @@ def build_create_or_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -119,7 +119,7 @@ def build_delete_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -154,7 +154,7 @@ def build_update_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) accept = _headers.pop("Accept", "application/json") @@ -198,7 +198,7 @@ def build_list_by_resource_group_request( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -234,7 +234,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-03")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-08-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py new file mode 100644 index 000000000000..d996188dde41 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python active_session_host_configurations_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.active_session_host_configurations.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ActiveSessionHostConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py new file mode 100644 index 000000000000..5590e8ef96b4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/active_session_host_configurations_list_by_host_pool.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python active_session_host_configurations_list_by_host_pool.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.active_session_host_configurations.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ActiveSessionHostConfigurations_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py index 1a3d9fc1eb08..aaf951c75489 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_create.py @@ -36,6 +36,7 @@ def main(): app_attach_package={ "location": "southcentralus", "properties": { + "customData": "", "failHealthCheckOnStagingFailure": "NeedsAssistance", "hostPoolReferences": [], "image": { @@ -72,12 +73,13 @@ def main(): "version": "packageversion", }, "keyVaultURL": "", + "packageOwnerName": "App Attach", }, }, ) print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/AppAttachPackage_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py index dbae419122ab..2f4b511ee3d7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/AppAttachPackage_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py index d3306b7757cc..db82982b8d43 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/AppAttachPackage_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py index 2c297780686a..cc07231d8ed1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_info_import_post.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackageInfo_Import_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/AppAttachPackageInfo_Import_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py index 3bfdde166329..5efc92f4aca2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/AppAttachPackage_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py index fb648e62a071..d6e9869a694f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/AppAttachPackage_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py index 0b1239001f98..0c30835cb2f8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/app_attach_package_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/AppAttachPackage_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/AppAttachPackage_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py index 0e99c30581fb..d7c85e1dd0cc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_create.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Application_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py index 849f2aadaafb..772d2d80cebd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Application_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py index 1ea6ce092768..a25c7719d95f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Application_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py index 95aff0aff571..57682cff7d48 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_create.py @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ApplicationGroup_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py index 22df1d08fa55..d2bc8e95d5e7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ApplicationGroup_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py index 25c26db4e667..599604350a32 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ApplicationGroup_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py index 0f30342aa9f3..b22e6bae220b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ApplicationGroup_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py index 514eaf021932..a1cc3086b0c5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ApplicationGroup_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py index a618dce1d629..a574e53ded24 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_group_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ApplicationGroup_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ApplicationGroup_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py index 0c964e1fbb90..cab5f41065be 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Application_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py index 1a5f906da636..e3aba4f7c011 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/application_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Application_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Application_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py index 18b47790ea7d..63a106afb406 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Desktop_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py index 753ecea64156..e76bebd8de45 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Desktop_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py index b358a4f54be6..f4dc52772fd1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/desktop_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Desktop_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Desktop_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py index 1da2cef16c77..b1ed8904da8d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_create.py @@ -44,16 +44,21 @@ def main(): }, "customRdpProperty": None, "description": "des1", + "directUDP": "Enabled", "friendlyName": "friendly", "hostPoolType": "Pooled", "loadBalancerType": "BreadthFirst", + "managedPrivateUDP": "Enabled", + "managementType": "Automated", "maxSessionLimit": 999999, "personalDesktopAssignmentType": "Automatic", "preferredAppGroupType": "Desktop", + "publicUDP": "Enabled", "registrationInfo": { "expirationTime": "2020-10-01T14:01:54.9571247Z", "registrationTokenOperation": "Update", }, + "relayUDP": "Enabled", "ssoClientId": "client", "ssoClientSecretKeyVaultPath": "https://keyvault/secret", "ssoSecretType": "SharedKey", @@ -67,6 +72,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPool_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py index c35977b4394e..52e89d943811 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPool_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py index bfc0c17fe097..20c5501c0875 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPool_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py index aa25e869679a..663a95dfeb38 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPool_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py index 50c8e0015963..002c96b72f6d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPool_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py index df9f0ded78f4..d76930d1dbc4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pool_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPool_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPool_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py index b808f45751fe..1f7fe05385c9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_list_registration_token_post.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPools_ListRegistrationToken_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPools_ListRegistrationToken_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py index a46f233a7b41..7232a17c7421 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/host_pools_retrieve_registration_token_post.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/HostPools_RetrieveRegistrationToken_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/HostPools_RetrieveRegistrationToken_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py index b3d1ee6faf49..388769676104 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_create.py @@ -69,6 +69,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/MsixPackage_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py index 35396a87ea47..6b139ced605e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/MsixPackage_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py index 122d3ac8bc1a..c09ddcabbae3 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/MsixPackage_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py index bdf2b76e629d..90091340b23a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/MsixPackage_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py index 816aede3d0d0..22a39447739d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/msix_package_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/MsixPackage_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/MsixPackage_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py index 7ba9404dee7d..41187693dfc4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/operation_description_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/OperationDescription_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/OperationDescription_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py index ee41840691d3..dea70ad723f5 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_host_pool.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_DeleteByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py index 15a006caf960..132d5b45c1dd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_delete_by_workspace.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_DeleteByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_DeleteByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py index f8660d4b0a81..40b13dbbd062 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_host_pool.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_GetByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py index f9b0589a2b64..968a4046e825 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_get_by_workspace.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_GetByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_GetByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py index 6d5201a27ce5..c13b5ef6a948 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_host_pool.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py index 6c41ad8e1512..eac22c19cabf 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_list_by_workspace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py index 5b17bbde82ed..0326574ca7d8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_host_pool.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_UpdateByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py index 8a10de65dfa8..a87b10188a5f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_endpoint_connection_update_by_workspace.py @@ -47,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateEndpointConnection_UpdateByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateEndpointConnection_UpdateByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py index 9374072152e6..a1da57d54332 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_host_pool.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateLinkResources_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateLinkResources_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py index da8ec5caceee..331cc4f9117b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/private_link_resources_list_by_workspace.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/PrivateLinkResources_ListByWorkspace.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/PrivateLinkResources_ListByWorkspace.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py index 2ccfc35fb645..024a53dd9498 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_create.py @@ -75,6 +75,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlan_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py index f627b071de76..f22973b30265 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlan_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py index b40c90aa5902..467db35a518b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlan_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py index c3635c78f0da..7f2feda2f975 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_host_pool.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlan_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py index b92cc80c5a82..69f6564be56d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlan_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py index b08092ed37bb..18a56172bba0 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlan_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py index 4055e6b7e02b..7ec423b0f634 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_create.py @@ -68,6 +68,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPersonalSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py index 77b4b85fa9a1..861140b28ba9 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPersonalSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py index 14d7e4d9b927..ebe99a7a1cad 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPersonalSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py index a1f7eb130178..1fe575cd96a1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPersonalSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py index ce57fd0e33db..ddd41fe8609c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_personal_schedule_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPersonalSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPersonalSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py index c02ca159aaed..22283ab41d87 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_create.py @@ -58,6 +58,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPooledSchedule_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py index f2d90dec35c5..88b579bb5e30 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPooledSchedule_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py index da2a627f4692..ddf9a6a0c692 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPooledSchedule_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py index 82033bd51b3a..8cb2e833fbb4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPooledSchedule_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py index cf4ad0c45745..f2677f37bb7e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_pooled_schedule_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlanPooledSchedule_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlanPooledSchedule_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py index ec6e2d3e7eaf..c596e24cacbf 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/scaling_plan_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/ScalingPlan_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/ScalingPlan_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py new file mode 100644 index 000000000000..021021ec8b7b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_create.py @@ -0,0 +1,92 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.begin_create_or_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_configuration={ + "properties": { + "availabilityZones": [1, 3], + "bootDiagnosticsInfo": { + "enabled": True, + "storageUri": "https://myStorageAccountName.blob.core.windows.net", + }, + "customConfigurationScriptUrl": "https://storageaccountname.blob.core.windows.net/blobcontainer/file", + "diskInfo": {"type": "Standard_LRS"}, + "domainInfo": { + "activeDirectoryInfo": { + "domainCredentials": { + "passwordKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/mysecretname", + "usernameKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/myusername", + }, + "domainName": "wvdarmtest1.net", + "ouPath": "OU=testOU,DC=domain,DC=Domain,DC=com", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "bdefabc0-95b4-48b3-b645-8a753a63c4fa"}, + "joinType": "ActiveDirectory", + }, + "friendlyName": "InitialConfiguration", + "imageInfo": { + "customInfo": { + "resourceId": "/subscriptions/daefabc0-95b4-48b3-b645-8a753a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.Compute/images/imageName" + }, + "marketplaceInfo": { + "exactVersion": "2019.0.20190115", + "offer": "Windows-10", + "publisher": "MicrosoftWindowsDesktop", + "sku": "19h2-ent", + }, + "type": "Marketplace", + }, + "networkInfo": { + "securityGroupId": "/subscriptions/.../resourceGroups/.../provider s/Microsoft.Network/networkSecurityGroups/nsg1", + "subnetId": "/subscriptions/.../resourceGroups/.../providers/Microsoft.Network/virtualNetworks/.../subnets/subnet1", + }, + "securityInfo": {"secureBootEnabled": True, "type": "TrustedLaunch", "vTpmEnabled": True}, + "vmAdminCredentials": { + "passwordKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/mysecretname", + "usernameKeyVaultSecretUri": "https://myvault.vault.azure.net/secrets/myusername", + }, + "vmLocation": "eastus2", + "vmNamePrefix": "westus2-vm", + "vmResourceGroup": "myResourceGroup", + "vmSizeId": "Standard_D2s_v3", + "vmTags": {"Department": "myDepartment", "Team": "myTeam"}, + } + }, + ).result() + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostConfigurations_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py new file mode 100644 index 000000000000..e444c1f1d326 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostConfigurations_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py new file mode 100644 index 000000000000..e0cdbecd558f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_list_by_host_pool.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_list_by_host_pool.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostConfigurations_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py new file mode 100644 index 000000000000..11b50a7fac4b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_configurations_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_configurations_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_configurations.begin_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ).result() + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostConfigurations_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py index 37aaf96a7d31..054cfb82ce35 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_delete.py @@ -37,6 +37,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHost_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py index cd1a39e42ce4..f5eb5f1c99b8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHost_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py index 59df6423ee56..d91a07ea310d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHost_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py new file mode 100644 index 000000000000..1319fb75abf3 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_control_session_host_update_post.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_control_session_host_update_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.control_session_host_update.begin_post( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + host_pool_update_control_parameter={"action": "Start", "cancelMessage": "Host pool update started"}, + ).result() + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostManagements_ControlSessionHostUpdate_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py new file mode 100644 index 000000000000..f4d897c0b86e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_create.py @@ -0,0 +1,53 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_create.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.create_or_update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_management={ + "properties": { + "scheduledDateTimeZone": "Alaskan Standard Time", + "update": { + "deleteOriginalVm": True, + "logOffDelayMinutes": 10, + "logOffMessage": "logging off for hostpool update", + "maxVmsRemoved": 4, + }, + } + }, + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostManagements_Create.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py new file mode 100644 index 000000000000..ff30abff10b8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostManagements_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py new file mode 100644 index 000000000000..c6329af1acff --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_list_by_host_pool.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_list_by_host_pool.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.list_by_host_pool( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + for item in response: + print(item) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostManagements_ListByHostPool.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py new file mode 100644 index 000000000000..997c777787b8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_update.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements.update( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostManagements_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py new file mode 100644 index 000000000000..97417c6972b5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_session_hosts_post.py @@ -0,0 +1,41 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_update_session_hosts_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.initiate_session_host_update.post( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostManagements_UpdateSessionHosts_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_status_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_status_get.py new file mode 100644 index 000000000000..6503cb801eb9 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_managements_update_status_get.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_managements_update_status_get.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + response = client.session_host_managements_update_status.get( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + ) + print(response) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHostManagements_UpdateStatus_Get.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py new file mode 100644 index 000000000000..10489acb31b2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_retry_provisioning_post.py @@ -0,0 +1,42 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-desktopvirtualization +# USAGE + python session_host_retry_provisioning_post.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = DesktopVirtualizationMgmtClient( + credential=DefaultAzureCredential(), + subscription_id="daefabc0-95b4-48b3-b645-8a753a63c4fa", + ) + + client.session_host.retry_provisioning( + resource_group_name="resourceGroup1", + host_pool_name="hostPool1", + session_host_name="sessionHost1.microsoft.com", + ) + + +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHost_RetryProvisioning_Post.json +if __name__ == "__main__": + main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py index 66a906828b50..ed6e9606a556 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/session_host_update.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/SessionHost_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/SessionHost_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py index 3947795d4bc0..89d1481f9e4d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/start_menu_item_list.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/StartMenuItem_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/StartMenuItem_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py index 9795cd6b3ea7..79e778efae6e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_delete.py @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/UserSession_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py index 56a22a9a2d33..d7d609907f9e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_disconnect_post.py @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Disconnect_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/UserSession_Disconnect_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py index 1c2dd0b04134..f78313262abd 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_get.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/UserSession_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py index 37e3dff31c75..3a573160b859 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list.py @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_List.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/UserSession_List.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py index 7ece20e47752..b438244a2896 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_list_by_host_pool.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_ListByHostPool.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/UserSession_ListByHostPool.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py index f3f3889c48e4..69f43c67769c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/user_session_send_message_post.py @@ -38,6 +38,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/UserSession_SendMessage_Post.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/UserSession_SendMessage_Post.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py index 3d2e16c4b669..852ee9c5cc36 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_create.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Create.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Workspace_Create.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py index 8c8f3f1bc584..5974009e789e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_delete.py @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Delete.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Workspace_Delete.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py index 32696811908c..f42f0cfe2c8f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Get.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Workspace_Get.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py index c9341a79edc5..bca684bcc2cc 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListByResourceGroup.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Workspace_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py index c21d95f4c0ee..ecd09561453f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_list_by_subscription.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_ListBySubscription.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Workspace_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py index ad8e24ed16eb..930bc7715748 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_samples/workspace_update.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/stable/2024-04-03/examples/Workspace_Update.json +# x-ms-original-file: specification/desktopvirtualization/resource-manager/Microsoft.DesktopVirtualization/preview/2024-04-08-preview/examples/Workspace_Update.json if __name__ == "__main__": main() diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations.py new file mode 100644 index 000000000000..742a26dc0d26 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations.py @@ -0,0 +1,43 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtActiveSessionHostConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.active_session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.active_session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations_async.py new file mode 100644 index 000000000000..03591a60c42c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_active_session_host_configurations_operations_async.py @@ -0,0 +1,44 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtActiveSessionHostConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.active_session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.active_session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py index c5eae9ca9116..61932613a11d 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations.py @@ -25,7 +25,7 @@ def test_import_method(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", import_package_info_request={"packageArchitecture": "str", "path": "str"}, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py index 381ce67c0991..cc2649d9ea90 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_info_operations_async.py @@ -26,7 +26,7 @@ async def test_import_method(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", import_package_info_request={"packageArchitecture": "str", "path": "str"}, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py index 2714c590f452..f9666666f11e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations.py @@ -24,7 +24,7 @@ def test_get(self, resource_group): response = self.client.app_attach_package.get( resource_group_name=resource_group.name, app_attach_package_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -39,6 +39,7 @@ def test_create_or_update(self, resource_group): app_attach_package={ "location": "str", "properties": { + "customData": "str", "failHealthCheckOnStagingFailure": "str", "hostPoolReferences": ["str"], "image": { @@ -70,6 +71,8 @@ def test_create_or_update(self, resource_group): "version": "str", }, "keyVaultURL": "str", + "packageLookbackUrl": "str", + "packageOwnerName": "str", "provisioningState": "str", }, "id": "str", @@ -85,7 +88,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -97,7 +100,7 @@ def test_delete(self, resource_group): response = self.client.app_attach_package.delete( resource_group_name=resource_group.name, app_attach_package_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -109,7 +112,7 @@ def test_update(self, resource_group): response = self.client.app_attach_package.update( resource_group_name=resource_group.name, app_attach_package_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -120,7 +123,7 @@ def test_update(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.app_attach_package.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -130,7 +133,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.app_attach_package.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py index fd872a32f0a4..19cbb5a895d7 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_app_attach_package_operations_async.py @@ -25,7 +25,7 @@ async def test_get(self, resource_group): response = await self.client.app_attach_package.get( resource_group_name=resource_group.name, app_attach_package_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -40,6 +40,7 @@ async def test_create_or_update(self, resource_group): app_attach_package={ "location": "str", "properties": { + "customData": "str", "failHealthCheckOnStagingFailure": "str", "hostPoolReferences": ["str"], "image": { @@ -71,6 +72,8 @@ async def test_create_or_update(self, resource_group): "version": "str", }, "keyVaultURL": "str", + "packageLookbackUrl": "str", + "packageOwnerName": "str", "provisioningState": "str", }, "id": "str", @@ -86,7 +89,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -98,7 +101,7 @@ async def test_delete(self, resource_group): response = await self.client.app_attach_package.delete( resource_group_name=resource_group.name, app_attach_package_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -110,7 +113,7 @@ async def test_update(self, resource_group): response = await self.client.app_attach_package.update( resource_group_name=resource_group.name, app_attach_package_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -121,7 +124,7 @@ async def test_update(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.app_attach_package.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -131,7 +134,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.app_attach_package.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py index d1193ef29383..17b8f0466d7b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations.py @@ -24,7 +24,7 @@ def test_get(self, resource_group): response = self.client.application_groups.get( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -45,7 +45,12 @@ def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -65,7 +70,7 @@ def test_create_or_update(self, resource_group): "type": "str", "workspaceArmPath": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -77,7 +82,7 @@ def test_delete(self, resource_group): response = self.client.application_groups.delete( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -89,7 +94,7 @@ def test_update(self, resource_group): response = self.client.application_groups.update( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -100,7 +105,7 @@ def test_update(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.application_groups.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -110,7 +115,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.application_groups.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py index 9f61dc9eeea4..40ed708df8d4 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_application_groups_operations_async.py @@ -25,7 +25,7 @@ async def test_get(self, resource_group): response = await self.client.application_groups.get( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -46,7 +46,12 @@ async def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -66,7 +71,7 @@ async def test_create_or_update(self, resource_group): "type": "str", "workspaceArmPath": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -78,7 +83,7 @@ async def test_delete(self, resource_group): response = await self.client.application_groups.delete( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -90,7 +95,7 @@ async def test_update(self, resource_group): response = await self.client.application_groups.update( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -101,7 +106,7 @@ async def test_update(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.application_groups.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -111,7 +116,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.application_groups.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py index c5e68ba8dec0..e37e1e5c7bc1 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", application_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", application_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -91,7 +91,7 @@ def test_update(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", application_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -103,7 +103,7 @@ def test_list(self, resource_group): response = self.client.applications.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py index 1490dbd499c1..1aa99f2af73a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_applications_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", application_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -66,7 +66,7 @@ async def test_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -79,7 +79,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", application_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -92,7 +92,7 @@ async def test_update(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", application_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -104,7 +104,7 @@ async def test_list(self, resource_group): response = self.client.applications.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations.py new file mode 100644 index 000000000000..8149b179f0b5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtControlSessionHostUpdateOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_post(self, resource_group): + response = self.client.control_session_host_update.begin_post( + resource_group_name=resource_group.name, + host_pool_name="str", + host_pool_update_control_parameter={"action": "str", "cancelMessage": "str"}, + api_version="2024-04-08-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations_async.py new file mode 100644 index 000000000000..fbe43970b3ef --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_control_session_host_update_operations_async.py @@ -0,0 +1,35 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtControlSessionHostUpdateOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_post(self, resource_group): + response = await ( + await self.client.control_session_host_update.begin_post( + resource_group_name=resource_group.name, + host_pool_name="str", + host_pool_update_control_parameter={"action": "str", "cancelMessage": "str"}, + api_version="2024-04-08-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py index 3f5ea7c08f41..6e148a8494c2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", desktop_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_update(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", desktop_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_list(self, resource_group): response = self.client.desktops.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py index 76f5dff1b61a..004fcf9250a6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_desktops_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", desktop_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ async def test_update(self, resource_group): resource_group_name=resource_group.name, application_group_name="str", desktop_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_list(self, resource_group): response = self.client.desktops.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py index 73087acdd2ba..0679dcdfba97 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations.py @@ -24,7 +24,7 @@ def test_get(self, resource_group): response = self.client.host_pools.get( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -52,12 +52,20 @@ def test_create_or_update(self, resource_group): "cloudPcResource": bool, "customRdpProperty": "str", "description": "str", + "directUDP": "str", "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", + "managedPrivateUDP": "str", + "managementType": "str", "maxSessionLimit": 0, "name": "str", "objectId": "str", @@ -87,11 +95,13 @@ def test_create_or_update(self, resource_group): } ], "publicNetworkAccess": "str", + "publicUDP": "str", "registrationInfo": { "expirationTime": "2020-02-20 00:00:00", "registrationTokenOperation": "str", "token": "str", }, + "relayUDP": "str", "ring": 0, "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "ssoClientId": "str", @@ -112,7 +122,7 @@ def test_create_or_update(self, resource_group): "validationEnvironment": bool, "vmTemplate": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -124,7 +134,7 @@ def test_delete(self, resource_group): response = self.client.host_pools.delete( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -136,7 +146,7 @@ def test_update(self, resource_group): response = self.client.host_pools.update( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -147,7 +157,7 @@ def test_update(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.host_pools.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -157,7 +167,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list(self, resource_group): response = self.client.host_pools.list( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -169,7 +179,7 @@ def test_retrieve_registration_token(self, resource_group): response = self.client.host_pools.retrieve_registration_token( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -181,7 +191,7 @@ def test_list_registration_tokens(self, resource_group): response = self.client.host_pools.list_registration_tokens( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py index 4433fbe943d4..fc68341e74da 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_host_pools_operations_async.py @@ -25,7 +25,7 @@ async def test_get(self, resource_group): response = await self.client.host_pools.get( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -53,12 +53,20 @@ async def test_create_or_update(self, resource_group): "cloudPcResource": bool, "customRdpProperty": "str", "description": "str", + "directUDP": "str", "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", + "managedPrivateUDP": "str", + "managementType": "str", "maxSessionLimit": 0, "name": "str", "objectId": "str", @@ -88,11 +96,13 @@ async def test_create_or_update(self, resource_group): } ], "publicNetworkAccess": "str", + "publicUDP": "str", "registrationInfo": { "expirationTime": "2020-02-20 00:00:00", "registrationTokenOperation": "str", "token": "str", }, + "relayUDP": "str", "ring": 0, "sku": {"name": "str", "capacity": 0, "family": "str", "size": "str", "tier": "str"}, "ssoClientId": "str", @@ -113,7 +123,7 @@ async def test_create_or_update(self, resource_group): "validationEnvironment": bool, "vmTemplate": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -125,7 +135,7 @@ async def test_delete(self, resource_group): response = await self.client.host_pools.delete( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -137,7 +147,7 @@ async def test_update(self, resource_group): response = await self.client.host_pools.update( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -148,7 +158,7 @@ async def test_update(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.host_pools.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -158,7 +168,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.host_pools.list( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -170,7 +180,7 @@ async def test_retrieve_registration_token(self, resource_group): response = await self.client.host_pools.retrieve_registration_token( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -182,7 +192,7 @@ async def test_list_registration_tokens(self, resource_group): response = await self.client.host_pools.list_registration_tokens( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations.py new file mode 100644 index 000000000000..1b2bb5aa34a5 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtInitiateSessionHostUpdateOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_post(self, resource_group): + response = self.client.initiate_session_host_update.post( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations_async.py new file mode 100644 index 000000000000..f76de2031747 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_initiate_session_host_update_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtInitiateSessionHostUpdateOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_post(self, resource_group): + response = await self.client.initiate_session_host_update.post( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py index e78b749b217e..e40d882cb6ec 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations.py @@ -25,7 +25,7 @@ def test_expand(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_image_uri={"uri": "str"}, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py index 05b1c49cf285..44f59686a12e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_images_operations_async.py @@ -26,7 +26,7 @@ async def test_expand(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_image_uri={"uri": "str"}, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py index a1f949c00531..0b21e4ef9a9f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_package_full_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -72,7 +72,7 @@ def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -85,7 +85,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_package_full_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -98,7 +98,7 @@ def test_update(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_package_full_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -110,7 +110,7 @@ def test_list(self, resource_group): response = self.client.msix_packages.list( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py index 5a015587b120..8d9bde91e6d8 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_msix_packages_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_package_full_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -73,7 +73,7 @@ async def test_create_or_update(self, resource_group): "type": "str", "version": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -86,7 +86,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_package_full_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -99,7 +99,7 @@ async def test_update(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", msix_package_full_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -111,7 +111,7 @@ async def test_list(self, resource_group): response = self.client.msix_packages.list( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py index 19082f23bd75..a1fb34f6621a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py index c1370b13dc27..29be32e23519 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py index a8bee2db3763..8af79d5f4919 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations.py @@ -24,7 +24,7 @@ def test_list_by_workspace(self, resource_group): response = self.client.private_endpoint_connections.list_by_workspace( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get_by_workspace(self, resource_group): resource_group_name=resource_group.name, workspace_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -50,7 +50,7 @@ def test_delete_by_workspace(self, resource_group): resource_group_name=resource_group.name, workspace_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -80,7 +80,7 @@ def test_update_by_workspace(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -92,7 +92,7 @@ def test_list_by_host_pool(self, resource_group): response = self.client.private_endpoint_connections.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -105,7 +105,7 @@ def test_get_by_host_pool(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -118,7 +118,7 @@ def test_delete_by_host_pool(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -148,7 +148,7 @@ def test_update_by_host_pool(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py index e871e0546acb..134e0949ff74 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_endpoint_connections_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_workspace(self, resource_group): response = self.client.private_endpoint_connections.list_by_workspace( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get_by_workspace(self, resource_group): resource_group_name=resource_group.name, workspace_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ async def test_delete_by_workspace(self, resource_group): resource_group_name=resource_group.name, workspace_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -81,7 +81,7 @@ async def test_update_by_workspace(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -93,7 +93,7 @@ async def test_list_by_host_pool(self, resource_group): response = self.client.private_endpoint_connections.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -106,7 +106,7 @@ async def test_get_by_host_pool(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -119,7 +119,7 @@ async def test_delete_by_host_pool(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", private_endpoint_connection_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -149,7 +149,7 @@ async def test_update_by_host_pool(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py index 5048e8fd8bf0..53e57069156c 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations.py @@ -24,7 +24,7 @@ def test_list_by_workspace(self, resource_group): response = self.client.private_link_resources.list_by_workspace( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -36,7 +36,7 @@ def test_list_by_host_pool(self, resource_group): response = self.client.private_link_resources.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.py index c7abaa0bb8f6..f1c2f8a6793f 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_private_link_resources_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_workspace(self, resource_group): response = self.client.private_link_resources.list_by_workspace( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ async def test_list_by_host_pool(self, resource_group): response = self.client.private_link_resources.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py index d4536d8b1c08..bddb70496550 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -77,7 +77,7 @@ def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -90,7 +90,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -103,7 +103,7 @@ def test_update(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -115,7 +115,7 @@ def test_list(self, resource_group): response = self.client.scaling_plan_personal_schedules.list( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py index cb66793c9144..425e247cf08b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_personal_schedules_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -78,7 +78,7 @@ async def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -91,7 +91,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -104,7 +104,7 @@ async def test_update(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -116,7 +116,7 @@ async def test_list(self, resource_group): response = self.client.scaling_plan_personal_schedules.list( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py index 973ae0f894fa..daf7c38e1a28 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -68,7 +68,7 @@ def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -81,7 +81,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -94,7 +94,7 @@ def test_update(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -106,7 +106,7 @@ def test_list(self, resource_group): response = self.client.scaling_plan_pooled_schedules.list( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py index 9ff2d9868812..097388bb681a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plan_pooled_schedules_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -69,7 +69,7 @@ async def test_create(self, resource_group): }, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -82,7 +82,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -95,7 +95,7 @@ async def test_update(self, resource_group): resource_group_name=resource_group.name, scaling_plan_name="str", scaling_plan_schedule_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -107,7 +107,7 @@ async def test_list(self, resource_group): response = self.client.scaling_plan_pooled_schedules.list( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py index cee2eaae558d..7bb1ca8586be 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations.py @@ -24,7 +24,7 @@ def test_get(self, resource_group): response = self.client.scaling_plans.get( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -46,7 +46,12 @@ def test_create(self, resource_group): "hostPoolReferences": [{"hostPoolArmPath": "str", "scalingPlanEnabled": bool}], "hostPoolType": "Pooled", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -86,7 +91,7 @@ def test_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -98,7 +103,7 @@ def test_delete(self, resource_group): response = self.client.scaling_plans.delete( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -110,7 +115,7 @@ def test_update(self, resource_group): response = self.client.scaling_plans.update( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -121,7 +126,7 @@ def test_update(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.scaling_plans.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -131,7 +136,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.scaling_plans.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -143,7 +148,7 @@ def test_list_by_host_pool(self, resource_group): response = self.client.scaling_plans.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py index bb5c7899e80d..5b533340d0ff 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_scaling_plans_operations_async.py @@ -25,7 +25,7 @@ async def test_get(self, resource_group): response = await self.client.scaling_plans.get( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -47,7 +47,12 @@ async def test_create(self, resource_group): "hostPoolReferences": [{"hostPoolArmPath": "str", "scalingPlanEnabled": bool}], "hostPoolType": "Pooled", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -87,7 +92,7 @@ async def test_create(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -99,7 +104,7 @@ async def test_delete(self, resource_group): response = await self.client.scaling_plans.delete( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -111,7 +116,7 @@ async def test_update(self, resource_group): response = await self.client.scaling_plans.update( resource_group_name=resource_group.name, scaling_plan_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -122,7 +127,7 @@ async def test_update(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.scaling_plans.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -132,7 +137,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.scaling_plans.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -144,7 +149,7 @@ async def test_list_by_host_pool(self, resource_group): response = self.client.scaling_plans.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations.py new file mode 100644 index 000000000000..c8fdd4a6180e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations.py @@ -0,0 +1,109 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostConfigurationsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_create_or_update(self, resource_group): + response = self.client.session_host_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_configuration={ + "diskInfo": {"type": "str"}, + "domainInfo": { + "joinType": "str", + "activeDirectoryInfo": { + "domainCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "ouPath": "str", + "domainName": "str", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "str"}, + }, + "imageInfo": { + "type": "str", + "customInfo": {"resourceId": "str"}, + "marketplaceInfo": {"exactVersion": "str", "offer": "str", "publisher": "str", "sku": "str"}, + }, + "networkInfo": {"subnetId": "str", "securityGroupId": "str"}, + "vmAdminCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "vmNamePrefix": "str", + "vmSizeId": "str", + "availabilityZones": [0], + "bootDiagnosticsInfo": {"enabled": bool, "storageUri": "str"}, + "customConfigurationScriptUrl": "str", + "friendlyName": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "securityInfo": {"secureBootEnabled": bool, "type": "str", "vTpmEnabled": bool}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "2020-02-20 00:00:00", + "vmLocation": "str", + "vmResourceGroup": "str", + "vmTags": {"str": "str"}, + }, + api_version="2024-04-08-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_begin_update(self, resource_group): + response = self.client.session_host_configurations.begin_update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations_async.py new file mode 100644 index 000000000000..8e2dd6665e9f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_configurations_operations_async.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostConfigurationsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_create_or_update(self, resource_group): + response = await ( + await self.client.session_host_configurations.begin_create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_configuration={ + "diskInfo": {"type": "str"}, + "domainInfo": { + "joinType": "str", + "activeDirectoryInfo": { + "domainCredentials": { + "passwordKeyVaultSecretUri": "str", + "usernameKeyVaultSecretUri": "str", + }, + "ouPath": "str", + "domainName": "str", + }, + "azureActiveDirectoryInfo": {"mdmProviderGuid": "str"}, + }, + "imageInfo": { + "type": "str", + "customInfo": {"resourceId": "str"}, + "marketplaceInfo": {"exactVersion": "str", "offer": "str", "publisher": "str", "sku": "str"}, + }, + "networkInfo": {"subnetId": "str", "securityGroupId": "str"}, + "vmAdminCredentials": {"passwordKeyVaultSecretUri": "str", "usernameKeyVaultSecretUri": "str"}, + "vmNamePrefix": "str", + "vmSizeId": "str", + "availabilityZones": [0], + "bootDiagnosticsInfo": {"enabled": bool, "storageUri": "str"}, + "customConfigurationScriptUrl": "str", + "friendlyName": "str", + "id": "str", + "name": "str", + "provisioningState": "str", + "securityInfo": {"secureBootEnabled": bool, "type": "str", "vTpmEnabled": bool}, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + "version": "2020-02-20 00:00:00", + "vmLocation": "str", + "vmResourceGroup": "str", + "vmTags": {"str": "str"}, + }, + api_version="2024-04-08-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_begin_update(self, resource_group): + response = await ( + await self.client.session_host_configurations.begin_update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.session_host_configurations.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_configurations.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations.py new file mode 100644 index 000000000000..3c0a06103402 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations.py @@ -0,0 +1,82 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.session_host_managements.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_create_or_update(self, resource_group): + response = self.client.session_host_managements.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_management={ + "scheduledDateTimeZone": "str", + "update": {"logOffDelayMinutes": 0, "maxVmsRemoved": 0, "deleteOriginalVm": bool, "logOffMessage": ""}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_update(self, resource_group): + response = self.client.session_host_managements.update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_managements.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations_async.py new file mode 100644 index 000000000000..78836ab8e08b --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_operations_async.py @@ -0,0 +1,83 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.session_host_managements.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_create_or_update(self, resource_group): + response = await self.client.session_host_managements.create_or_update( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_management={ + "scheduledDateTimeZone": "str", + "update": {"logOffDelayMinutes": 0, "maxVmsRemoved": 0, "deleteOriginalVm": bool, "logOffMessage": ""}, + "id": "str", + "name": "str", + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + }, + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_update(self, resource_group): + response = await self.client.session_host_managements.update( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_list_by_host_pool(self, resource_group): + response = self.client.session_host_managements.list_by_host_pool( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations.py new file mode 100644 index 000000000000..753f8c1ff58a --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsUpdateStatusOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_get(self, resource_group): + response = self.client.session_host_managements_update_status.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations_async.py new file mode 100644 index 000000000000..0c63451207a8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_managements_update_status_operations_async.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostManagementsUpdateStatusOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_get(self, resource_group): + response = await self.client.session_host_managements_update_status.get( + resource_group_name=resource_group.name, + host_pool_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations.py new file mode 100644 index 000000000000..97bec7a5dbed --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations.py @@ -0,0 +1,32 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_retry_provisioning(self, resource_group): + response = self.client.session_host.retry_provisioning( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations_async.py new file mode 100644 index 000000000000..1a037847cb18 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_host_operations_async.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.desktopvirtualization.aio import DesktopVirtualizationMgmtClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestDesktopVirtualizationMgmtSessionHostOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(DesktopVirtualizationMgmtClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_retry_provisioning(self, resource_group): + response = await self.client.session_host.retry_provisioning( + resource_group_name=resource_group.name, + host_pool_name="str", + session_host_name="str", + api_version="2024-04-08-preview", + ) + + # please add some check logic here by yourself + # ... diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py index f6da35d6d8da..abac7dc9580a 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations.py @@ -25,7 +25,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_delete(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -51,7 +51,7 @@ def test_update(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -63,7 +63,7 @@ def test_list(self, resource_group): response = self.client.session_hosts.list( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py index 3760951a7af3..de364e98e07e 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_session_hosts_operations_async.py @@ -26,7 +26,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -39,7 +39,7 @@ async def test_delete(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -52,7 +52,7 @@ async def test_update(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -64,7 +64,7 @@ async def test_list(self, resource_group): response = self.client.session_hosts.list( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py index 0f2cf1687abc..b56f1d06ac3b 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations.py @@ -24,7 +24,7 @@ def test_list(self, resource_group): response = self.client.start_menu_items.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py index 0cc0958c5005..3ff9abf57afa 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_start_menu_items_operations_async.py @@ -25,7 +25,7 @@ async def test_list(self, resource_group): response = self.client.start_menu_items.list( resource_group_name=resource_group.name, application_group_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py index 8b9a2c864beb..df0a809dc265 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations.py @@ -24,7 +24,7 @@ def test_list_by_host_pool(self, resource_group): response = self.client.user_sessions.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ def test_get(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -52,7 +52,7 @@ def test_delete(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -65,7 +65,7 @@ def test_list(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -79,7 +79,7 @@ def test_disconnect(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -93,7 +93,7 @@ def test_send_message(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py index a03d5750b173..6f39e4cf7ace 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_user_sessions_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_host_pool(self, resource_group): response = self.client.user_sessions.list_by_host_pool( resource_group_name=resource_group.name, host_pool_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -39,7 +39,7 @@ async def test_get(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -53,7 +53,7 @@ async def test_delete(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -66,7 +66,7 @@ async def test_list(self, resource_group): resource_group_name=resource_group.name, host_pool_name="str", session_host_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -80,7 +80,7 @@ async def test_disconnect(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -94,7 +94,7 @@ async def test_send_message(self, resource_group): host_pool_name="str", session_host_name="str", user_session_id="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py index aee123acbae0..0ef9001daea6 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations.py @@ -24,7 +24,7 @@ def test_get(self, resource_group): response = self.client.workspaces.get( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -44,7 +44,12 @@ def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -86,7 +91,7 @@ def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -98,7 +103,7 @@ def test_delete(self, resource_group): response = self.client.workspaces.delete( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -110,7 +115,7 @@ def test_update(self, resource_group): response = self.client.workspaces.update( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -121,7 +126,7 @@ def test_update(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.workspaces.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -131,7 +136,7 @@ def test_list_by_resource_group(self, resource_group): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.workspaces.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py index dd1d71f33f85..63e9243733d2 100644 --- a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/generated_tests/test_desktop_virtualization_mgmt_workspaces_operations_async.py @@ -25,7 +25,7 @@ async def test_get(self, resource_group): response = await self.client.workspaces.get( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -45,7 +45,12 @@ async def test_create_or_update(self, resource_group): "etag": "str", "friendlyName": "str", "id": "str", - "identity": {"principalId": "str", "tenantId": "str", "type": "SystemAssigned"}, + "identity": { + "type": "str", + "principalId": "str", + "tenantId": "str", + "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, + }, "kind": "str", "managedBy": "str", "name": "str", @@ -87,7 +92,7 @@ async def test_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -99,7 +104,7 @@ async def test_delete(self, resource_group): response = await self.client.workspaces.delete( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -111,7 +116,7 @@ async def test_update(self, resource_group): response = await self.client.workspaces.update( resource_group_name=resource_group.name, workspace_name="str", - api_version="2024-04-03", + api_version="2024-04-08-preview", ) # please add some check logic here by yourself @@ -122,7 +127,7 @@ async def test_update(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.workspaces.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -132,7 +137,7 @@ async def test_list_by_resource_group(self, resource_group): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.workspaces.list_by_subscription( - api_version="2024-04-03", + api_version="2024-04-08-preview", ) result = [r async for r in response] # please add some check logic here by yourself