From a6daa5b1a0d5dbfb12ef9aa686ae70313b4331dc Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 28 Oct 2021 05:35:35 +0000 Subject: [PATCH] CodeGen from PR 16579 in Azure/azure-rest-api-specs Merge 187289cc80cb58b335f655e1a27f7a827d87a152 into c24ee32fb97dfefbeb34df5f981af8470bdf6593 --- .../CHANGELOG.md | 5 + .../LICENSE.txt | 21 + .../MANIFEST.in | 6 + .../README.md | 27 + .../_meta.json | 11 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../mgmt/desktopvirtualization/__init__.py | 19 + .../desktopvirtualization/_configuration.py | 71 + .../_desktop_virtualization_api_client.py | 153 + .../mgmt/desktopvirtualization/_metadata.json | 116 + .../mgmt/desktopvirtualization/_version.py | 9 + .../desktopvirtualization/aio/__init__.py | 10 + .../aio/_configuration.py | 67 + .../aio/_desktop_virtualization_api_client.py | 146 + .../aio/operations/__init__.py | 39 + .../_application_groups_operations.py | 442 +++ .../operations/_applications_operations.py | 384 ++ .../aio/operations/_desktops_operations.py | 251 ++ .../aio/operations/_host_pools_operations.py | 493 +++ .../aio/operations/_msix_images_operations.py | 127 + .../operations/_msix_packages_operations.py | 388 ++ .../aio/operations/_operations.py | 104 + ...private_endpoint_connections_operations.py | 578 +++ .../_private_link_resources_operations.py | 190 + .../operations/_scaling_plans_operations.py | 504 +++ .../operations/_session_hosts_operations.py | 320 ++ .../_start_menu_items_operations.py | 116 + .../operations/_user_sessions_operations.py | 471 +++ .../aio/operations/_workspaces_operations.py | 430 ++ .../desktopvirtualization/models/__init__.py | 261 ++ ...desktop_virtualization_api_client_enums.py | 327 ++ .../desktopvirtualization/models/_models.py | 3114 +++++++++++++++ .../models/_models_py3.py | 3469 +++++++++++++++++ .../operations/__init__.py | 39 + .../_application_groups_operations.py | 452 +++ .../operations/_applications_operations.py | 393 ++ .../operations/_desktops_operations.py | 258 ++ .../operations/_host_pools_operations.py | 504 +++ .../operations/_msix_images_operations.py | 132 + .../operations/_msix_packages_operations.py | 397 ++ .../operations/_operations.py | 109 + ...private_endpoint_connections_operations.py | 590 +++ .../_private_link_resources_operations.py | 196 + .../operations/_scaling_plans_operations.py | 515 +++ .../operations/_session_hosts_operations.py | 328 ++ .../_start_menu_items_operations.py | 121 + .../operations/_user_sessions_operations.py | 481 +++ .../operations/_workspaces_operations.py | 440 +++ .../azure/mgmt/desktopvirtualization/py.typed | 1 + .../sdk_packaging.toml | 9 + .../setup.cfg | 2 + .../azure-mgmt-desktopvirtualization/setup.py | 90 + sdk/desktopvirtualization/ci.yml | 33 + 54 files changed, 17761 insertions(+) create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/CHANGELOG.md create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/LICENSE.txt create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/MANIFEST.in create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/__init__.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/__init__.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/py.typed create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/sdk_packaging.toml create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.cfg create mode 100644 sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py create mode 100644 sdk/desktopvirtualization/ci.yml diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/CHANGELOG.md b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/CHANGELOG.md new file mode 100644 index 000000000000..578ed6acf479 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 0.1.0 (1970-01-01) + +* Initial Release diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/LICENSE.txt b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/LICENSE.txt new file mode 100644 index 000000000000..2d3163745319 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/LICENSE.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2021 Microsoft + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/MANIFEST.in b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/MANIFEST.in new file mode 100644 index 000000000000..ef61eb0e3527 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE.txt diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md new file mode 100644 index 000000000000..87e5d748d83f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/README.md @@ -0,0 +1,27 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure MyService Management Client Library. +This package has been tested with Python 2.7, 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-desktopvirtualization%2FREADME.png) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json new file mode 100644 index 000000000000..a2f293cdb5c2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.4.5", + "use": [ + "@autorest/python@5.8.4", + "@autorest/modelerfour@4.19.2" + ], + "commit": "2635613d4b14061e8c7f3719bbcaf68cf079acfd", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/desktopvirtualization/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "readme": "specification/desktopvirtualization/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py new file mode 100644 index 000000000000..fcebd4b56540 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/__init__.py @@ -0,0 +1,19 @@ +# 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 ._desktop_virtualization_api_client import DesktopVirtualizationAPIClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['DesktopVirtualizationAPIClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py new file mode 100644 index 000000000000..ffa93f1c794f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any + + from azure.core.credentials import TokenCredential + + +class DesktopVirtualizationAPIClientConfiguration(Configuration): + """Configuration for DesktopVirtualizationAPIClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(DesktopVirtualizationAPIClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-09-03-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-desktopvirtualization/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py new file mode 100644 index 000000000000..40177dec69db --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_desktop_virtualization_api_client.py @@ -0,0 +1,153 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.mgmt.core import ARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Optional + + from azure.core.credentials import TokenCredential + from azure.core.pipeline.transport import HttpRequest, HttpResponse + +from ._configuration import DesktopVirtualizationAPIClientConfiguration +from .operations import Operations +from .operations import WorkspacesOperations +from .operations import ScalingPlansOperations +from .operations import ApplicationGroupsOperations +from .operations import StartMenuItemsOperations +from .operations import ApplicationsOperations +from .operations import DesktopsOperations +from .operations import HostPoolsOperations +from .operations import UserSessionsOperations +from .operations import SessionHostsOperations +from .operations import MSIXPackagesOperations +from .operations import MsixImagesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from . import models + + +class DesktopVirtualizationAPIClient(object): + """DesktopVirtualizationAPIClient. + + :ivar operations: Operations operations + :vartype operations: desktop_virtualization_api_client.operations.Operations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: desktop_virtualization_api_client.operations.WorkspacesOperations + :ivar scaling_plans: ScalingPlansOperations operations + :vartype scaling_plans: desktop_virtualization_api_client.operations.ScalingPlansOperations + :ivar application_groups: ApplicationGroupsOperations operations + :vartype application_groups: desktop_virtualization_api_client.operations.ApplicationGroupsOperations + :ivar start_menu_items: StartMenuItemsOperations operations + :vartype start_menu_items: desktop_virtualization_api_client.operations.StartMenuItemsOperations + :ivar applications: ApplicationsOperations operations + :vartype applications: desktop_virtualization_api_client.operations.ApplicationsOperations + :ivar desktops: DesktopsOperations operations + :vartype desktops: desktop_virtualization_api_client.operations.DesktopsOperations + :ivar host_pools: HostPoolsOperations operations + :vartype host_pools: desktop_virtualization_api_client.operations.HostPoolsOperations + :ivar user_sessions: UserSessionsOperations operations + :vartype user_sessions: desktop_virtualization_api_client.operations.UserSessionsOperations + :ivar session_hosts: SessionHostsOperations operations + :vartype session_hosts: desktop_virtualization_api_client.operations.SessionHostsOperations + :ivar msix_packages: MSIXPackagesOperations operations + :vartype msix_packages: desktop_virtualization_api_client.operations.MSIXPackagesOperations + :ivar msix_images: MsixImagesOperations operations + :vartype msix_images: desktop_virtualization_api_client.operations.MsixImagesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: desktop_virtualization_api_client.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: desktop_virtualization_api_client.operations.PrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = DesktopVirtualizationAPIClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.scaling_plans = ScalingPlansOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_groups = ApplicationGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.start_menu_items = StartMenuItemsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.desktops = DesktopsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.host_pools = HostPoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.user_sessions = UserSessionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.session_hosts = SessionHostsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.msix_packages = MSIXPackagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.msix_images = MsixImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def _send_request(self, http_request, **kwargs): + # type: (HttpRequest, Any) -> HttpResponse + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.HttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> DesktopVirtualizationAPIClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json new file mode 100644 index 000000000000..904a9e59c437 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_metadata.json @@ -0,0 +1,116 @@ +{ + "chosen_version": "2021-09-03-preview", + "total_api_version_list": ["2021-09-03-preview"], + "client": { + "name": "DesktopVirtualizationAPIClient", + "filename": "_desktop_virtualization_api_client", + "description": "DesktopVirtualizationAPIClient.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": false, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DesktopVirtualizationAPIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"DesktopVirtualizationAPIClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=None, # type: Optional[str]", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: Optional[str] = None,", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_default_policy_type": "BearerTokenCredentialPolicy", + "credential_default_policy_type_has_async_version": true, + "credential_key_header_name": null, + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "operations": "Operations", + "workspaces": "WorkspacesOperations", + "scaling_plans": "ScalingPlansOperations", + "application_groups": "ApplicationGroupsOperations", + "start_menu_items": "StartMenuItemsOperations", + "applications": "ApplicationsOperations", + "desktops": "DesktopsOperations", + "host_pools": "HostPoolsOperations", + "user_sessions": "UserSessionsOperations", + "session_hosts": "SessionHostsOperations", + "msix_packages": "MSIXPackagesOperations", + "msix_images": "MsixImagesOperations", + "private_endpoint_connections": "PrivateEndpointConnectionsOperations", + "private_link_resources": "PrivateLinkResourcesOperations" + } +} \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py new file mode 100644 index 000000000000..3160c7b3c306 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._desktop_virtualization_api_client import DesktopVirtualizationAPIClient +__all__ = ['DesktopVirtualizationAPIClient'] 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 new file mode 100644 index 000000000000..b3c5015744c4 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class DesktopVirtualizationAPIClientConfiguration(Configuration): + """Configuration for DesktopVirtualizationAPIClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(DesktopVirtualizationAPIClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-09-03-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-desktopvirtualization/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py new file mode 100644 index 000000000000..f0b1d0e9141c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/_desktop_virtualization_api_client.py @@ -0,0 +1,146 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +from ._configuration import DesktopVirtualizationAPIClientConfiguration +from .operations import Operations +from .operations import WorkspacesOperations +from .operations import ScalingPlansOperations +from .operations import ApplicationGroupsOperations +from .operations import StartMenuItemsOperations +from .operations import ApplicationsOperations +from .operations import DesktopsOperations +from .operations import HostPoolsOperations +from .operations import UserSessionsOperations +from .operations import SessionHostsOperations +from .operations import MSIXPackagesOperations +from .operations import MsixImagesOperations +from .operations import PrivateEndpointConnectionsOperations +from .operations import PrivateLinkResourcesOperations +from .. import models + + +class DesktopVirtualizationAPIClient(object): + """DesktopVirtualizationAPIClient. + + :ivar operations: Operations operations + :vartype operations: desktop_virtualization_api_client.aio.operations.Operations + :ivar workspaces: WorkspacesOperations operations + :vartype workspaces: desktop_virtualization_api_client.aio.operations.WorkspacesOperations + :ivar scaling_plans: ScalingPlansOperations operations + :vartype scaling_plans: desktop_virtualization_api_client.aio.operations.ScalingPlansOperations + :ivar application_groups: ApplicationGroupsOperations operations + :vartype application_groups: desktop_virtualization_api_client.aio.operations.ApplicationGroupsOperations + :ivar start_menu_items: StartMenuItemsOperations operations + :vartype start_menu_items: desktop_virtualization_api_client.aio.operations.StartMenuItemsOperations + :ivar applications: ApplicationsOperations operations + :vartype applications: desktop_virtualization_api_client.aio.operations.ApplicationsOperations + :ivar desktops: DesktopsOperations operations + :vartype desktops: desktop_virtualization_api_client.aio.operations.DesktopsOperations + :ivar host_pools: HostPoolsOperations operations + :vartype host_pools: desktop_virtualization_api_client.aio.operations.HostPoolsOperations + :ivar user_sessions: UserSessionsOperations operations + :vartype user_sessions: desktop_virtualization_api_client.aio.operations.UserSessionsOperations + :ivar session_hosts: SessionHostsOperations operations + :vartype session_hosts: desktop_virtualization_api_client.aio.operations.SessionHostsOperations + :ivar msix_packages: MSIXPackagesOperations operations + :vartype msix_packages: desktop_virtualization_api_client.aio.operations.MSIXPackagesOperations + :ivar msix_images: MsixImagesOperations operations + :vartype msix_images: desktop_virtualization_api_client.aio.operations.MsixImagesOperations + :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations + :vartype private_endpoint_connections: desktop_virtualization_api_client.aio.operations.PrivateEndpointConnectionsOperations + :ivar private_link_resources: PrivateLinkResourcesOperations operations + :vartype private_link_resources: desktop_virtualization_api_client.aio.operations.PrivateLinkResourcesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param str base_url: Service URL + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = DesktopVirtualizationAPIClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._serialize.client_side_validation = False + self._deserialize = Deserializer(client_models) + + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.workspaces = WorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.scaling_plans = ScalingPlansOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_groups = ApplicationGroupsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.start_menu_items = StartMenuItemsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.desktops = DesktopsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.host_pools = HostPoolsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.user_sessions = UserSessionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.session_hosts = SessionHostsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.msix_packages = MSIXPackagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.msix_images = MsixImagesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + """Runs the network request through the client's chained policies. + + :param http_request: The network request you want to make. Required. + :type http_request: ~azure.core.pipeline.transport.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + """ + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + http_request.url = self._client.format_url(http_request.url, **path_format_arguments) + stream = kwargs.pop("stream", True) + pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) + return pipeline_response.http_response + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "DesktopVirtualizationAPIClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) 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 new file mode 100644 index 000000000000..63576d0654da --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/__init__.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._workspaces_operations import WorkspacesOperations +from ._scaling_plans_operations import ScalingPlansOperations +from ._application_groups_operations import ApplicationGroupsOperations +from ._start_menu_items_operations import StartMenuItemsOperations +from ._applications_operations import ApplicationsOperations +from ._desktops_operations import DesktopsOperations +from ._host_pools_operations import HostPoolsOperations +from ._user_sessions_operations import UserSessionsOperations +from ._session_hosts_operations import SessionHostsOperations +from ._msix_packages_operations import MSIXPackagesOperations +from ._msix_images_operations import MsixImagesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations + +__all__ = [ + 'Operations', + 'WorkspacesOperations', + 'ScalingPlansOperations', + 'ApplicationGroupsOperations', + 'StartMenuItemsOperations', + 'ApplicationsOperations', + 'DesktopsOperations', + 'HostPoolsOperations', + 'UserSessionsOperations', + 'SessionHostsOperations', + 'MSIXPackagesOperations', + 'MsixImagesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', +] diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py new file mode 100644 index 000000000000..46ebddcc524f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_application_groups_operations.py @@ -0,0 +1,442 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationGroupsOperations: + """ApplicationGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> "_models.ApplicationGroup": + """Get an application group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGroup, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('ApplicationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + application_group_name: str, + application_group: "_models.ApplicationGroup", + **kwargs: Any + ) -> "_models.ApplicationGroup": + """Create or update an applicationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_group: Object containing ApplicationGroup definitions. + :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGroup, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(application_group, 'ApplicationGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> None: + """Remove an applicationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + application_group_name: str, + application_group: Optional["_models.ApplicationGroupPatch"] = None, + **kwargs: Any + ) -> "_models.ApplicationGroup": + """Update an applicationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_group: Object containing ApplicationGroup definitions. + :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroupPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGroup, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if application_group is not None: + body_content = self._serialize.body(application_group, 'ApplicationGroupPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('ApplicationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationGroupList"]: + """List applicationGroups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are + applicationGroupType. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationGroupList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore + + def list_by_subscription( + self, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationGroupList"]: + """List applicationGroups in subscription. + + :param filter: OData filter expression. Valid properties for filtering are + applicationGroupType. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationGroupList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py new file mode 100644 index 000000000000..e3ae135cc559 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_applications_operations.py @@ -0,0 +1,384 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationsOperations: + """ApplicationsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + application_group_name: str, + application_name: str, + **kwargs: Any + ) -> "_models.Application": + """Get an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + application_group_name: str, + application_name: str, + application: "_models.Application", + **kwargs: Any + ) -> "_models.Application": + """Create or update an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :param application: Object containing Application definitions. + :type application: ~desktop_virtualization_api_client.models.Application + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(application, 'Application') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Application', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + application_group_name: str, + application_name: str, + **kwargs: Any + ) -> None: + """Remove an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + application_group_name: str, + application_name: str, + application: Optional["_models.ApplicationPatch"] = None, + **kwargs: Any + ) -> "_models.Application": + """Update an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :param application: Object containing Application definitions. + :type application: ~desktop_virtualization_api_client.models.ApplicationPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if application is not None: + body_content = self._serialize.body(application, 'ApplicationPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + def list( + self, + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ApplicationList"]: + """List applications. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ApplicationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py new file mode 100644 index 000000000000..8fe2d9073f00 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_desktops_operations.py @@ -0,0 +1,251 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DesktopsOperations: + """DesktopsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + application_group_name: str, + desktop_name: str, + **kwargs: Any + ) -> "_models.Desktop": + """Get a desktop. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param desktop_name: The name of the desktop within the specified desktop group. + :type desktop_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Desktop, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('Desktop', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + application_group_name: str, + desktop_name: str, + desktop: Optional["_models.DesktopPatch"] = None, + **kwargs: Any + ) -> "_models.Desktop": + """Update a desktop. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param desktop_name: The name of the desktop within the specified desktop group. + :type desktop_name: str + :param desktop: Object containing Desktop definitions. + :type desktop: ~desktop_virtualization_api_client.models.DesktopPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Desktop, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if desktop is not None: + body_content = self._serialize.body(desktop, 'DesktopPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('Desktop', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + + def list( + self, + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DesktopList"]: + """List desktops. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DesktopList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.DesktopList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DesktopList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('DesktopList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py new file mode 100644 index 000000000000..1af3c03a2e92 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_host_pools_operations.py @@ -0,0 +1,493 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class HostPoolsOperations: + """HostPoolsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> "_models.HostPool": + """Get a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPool, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('HostPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + host_pool: "_models.HostPool", + **kwargs: Any + ) -> "_models.HostPool": + """Create or update a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param host_pool: Object containing HostPool definitions. + :type host_pool: ~desktop_virtualization_api_client.models.HostPool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPool, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_pool, 'HostPool') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('HostPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('HostPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + host_pool_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: + """Remove a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param force: Force flag to delete sessionHost. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + host_pool_name: str, + host_pool: Optional["_models.HostPoolPatch"] = None, + **kwargs: Any + ) -> "_models.HostPool": + """Update a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param host_pool: Object containing HostPool definitions. + :type host_pool: ~desktop_virtualization_api_client.models.HostPoolPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPool, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if host_pool is not None: + body_content = self._serialize.body(host_pool, 'HostPoolPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('HostPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.HostPoolList"]: + """List hostPools. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostPoolList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('HostPoolList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.HostPoolList"]: + """List hostPools in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostPoolList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('HostPoolList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + + async def retrieve_registration_token( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> "_models.RegistrationInfo": + """Registration token of the host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistrationInfo, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.RegistrationInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistrationInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.retrieve_registration_token.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('RegistrationInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_registration_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py new file mode 100644 index 000000000000..ca996fc5e294 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_images_operations.py @@ -0,0 +1,127 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MsixImagesOperations: + """MsixImagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def expand( + self, + resource_group_name: str, + host_pool_name: str, + msix_image_uri: "_models.MSIXImageURI", + **kwargs: Any + ) -> AsyncIterable["_models.ExpandMsixImageList"]: + """Expands and Lists MSIX packages in an Image, given the Image Path. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_image_uri: Object containing URI to MSIX Image. + :type msix_image_uri: ~desktop_virtualization_api_client.models.MSIXImageURI + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpandMsixImageList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ExpandMsixImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpandMsixImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.expand.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ExpandMsixImageList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py new file mode 100644 index 000000000000..cc3e816f638c --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_msix_packages_operations.py @@ -0,0 +1,388 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class MSIXPackagesOperations: + """MSIXPackagesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + **kwargs: Any + ) -> "_models.MSIXPackage": + """Get a msixpackage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSIXPackage, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('MSIXPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + msix_package: "_models.MSIXPackage", + **kwargs: Any + ) -> "_models.MSIXPackage": + """Create or update a MSIX package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :param msix_package: Object containing MSIX Package definitions. + :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSIXPackage, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(msix_package, 'MSIXPackage') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('MSIXPackage', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('MSIXPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + **kwargs: Any + ) -> None: + """Remove an MSIX Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + host_pool_name: str, + msix_package_full_name: str, + msix_package: Optional["_models.MSIXPackagePatch"] = None, + **kwargs: Any + ) -> "_models.MSIXPackage": + """Update an MSIX Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :param msix_package: Object containing MSIX Package definitions. + :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackagePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSIXPackage, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if msix_package is not None: + body_content = self._serialize.body(msix_package, 'MSIXPackagePatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('MSIXPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + def list( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.MSIXPackageList"]: + """List MSIX packages in hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MSIXPackageList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.MSIXPackageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('MSIXPackageList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py new file mode 100644 index 000000000000..09238b5f3413 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_operations.py @@ -0,0 +1,104 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ResourceProviderOperationList"]: + """List all of the available operations the Desktop Virtualization resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ResourceProviderOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/providers/Microsoft.DesktopVirtualization/operations'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..b88375bb62b7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,578 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations: + """PrivateEndpointConnectionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResultWithSystemData"]: + """List private endpoint connections associated with hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections'} # type: ignore + + async def get_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": + """Get a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def delete_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Remove a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def update_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + private_endpoint_connection_name: str, + connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": + """Approve or reject a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param connection: Object containing the updated connection. + :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateEndpointConnectionListResultWithSystemData"]: + """List private endpoint connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore + + async def get_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": + """Get a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def delete_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + **kwargs: Any + ) -> None: + """Remove a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + async def update_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + private_endpoint_connection_name: str, + connection: "_models.PrivateEndpointConnection", + **kwargs: Any + ) -> "_models.PrivateEndpointConnectionWithSystemData": + """Approve or reject a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param connection: Object containing the updated connection. + :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py new file mode 100644 index 000000000000..da58a5f3d051 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_private_link_resources_operations.py @@ -0,0 +1,190 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations: + """PrivateLinkResourcesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: + """List the private link resources available for this hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources'} # type: ignore + + def list_by_workspace( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.PrivateLinkResourceListResult"]: + """List the private link resources available for this workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py new file mode 100644 index 000000000000..2efe4941d547 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_scaling_plans_operations.py @@ -0,0 +1,504 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ScalingPlansOperations: + """ScalingPlansOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + scaling_plan_name: str, + **kwargs: Any + ) -> "_models.ScalingPlan": + """Get a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScalingPlan, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('ScalingPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + async def create( + self, + resource_group_name: str, + scaling_plan_name: str, + scaling_plan: "_models.ScalingPlan", + **kwargs: Any + ) -> "_models.ScalingPlan": + """Create or update a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :param scaling_plan: Object containing scaling plan definitions. + :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlan + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScalingPlan, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(scaling_plan, 'ScalingPlan') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('ScalingPlan', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScalingPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + scaling_plan_name: str, + **kwargs: Any + ) -> None: + """Remove a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + scaling_plan_name: str, + scaling_plan: Optional["_models.ScalingPlanPatch"] = None, + **kwargs: Any + ) -> "_models.ScalingPlan": + """Update a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :param scaling_plan: Object containing scaling plan definitions. + :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlanPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScalingPlan, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if scaling_plan is not None: + body_content = self._serialize.body(scaling_plan, 'ScalingPlanPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('ScalingPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ScalingPlanList"]: + """List scaling plans. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScalingPlanList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScalingPlanList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ScalingPlanList"]: + """List scaling plans in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScalingPlanList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScalingPlanList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ScalingPlanList"]: + """List scaling plan associated with hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScalingPlanList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ScalingPlanList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py new file mode 100644 index 000000000000..ad2bccd104f7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_session_hosts_operations.py @@ -0,0 +1,320 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SessionHostsOperations: + """SessionHostsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + **kwargs: Any + ) -> "_models.SessionHost": + """Get a session host. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHost, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('SessionHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: + """Remove a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param force: Force flag to force sessionHost deletion even when userSession exists. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + force: Optional[bool] = None, + session_host: Optional["_models.SessionHostPatch"] = None, + **kwargs: Any + ) -> "_models.SessionHost": + """Update a session host. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param force: Force flag to update assign, unassign or reassign personal desktop. + :type force: bool + :param session_host: Object containing SessionHost definitions. + :type session_host: ~desktop_virtualization_api_client.models.SessionHostPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHost, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if session_host is not None: + body_content = self._serialize.body(session_host, 'SessionHostPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('SessionHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + + def list( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SessionHostList"]: + """List sessionHosts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.SessionHostList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHostList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('SessionHostList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py new file mode 100644 index 000000000000..2307bae8b8c2 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_start_menu_items_operations.py @@ -0,0 +1,116 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StartMenuItemsOperations: + """StartMenuItemsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name: str, + application_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.StartMenuItemList"]: + """List start menu items in the given application group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StartMenuItemList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.StartMenuItemList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StartMenuItemList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('StartMenuItemList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py new file mode 100644 index 000000000000..c8ede54eb807 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_user_sessions_operations.py @@ -0,0 +1,471 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UserSessionsOperations: + """UserSessionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_host_pool( + self, + resource_group_name: str, + host_pool_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.UserSessionList"]: + """List userSessions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param filter: OData filter expression. Valid properties for filtering are userprincipalname + and sessionstate. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserSessionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('UserSessionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions'} # type: ignore + + async def get( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs: Any + ) -> "_models.UserSession": + """Get a userSession. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSession, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.UserSession + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSession"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('UserSession', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + force: Optional[bool] = None, + **kwargs: Any + ) -> None: + """Remove a userSession. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :param force: Force flag to login off userSession. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore + + def list( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.UserSessionList"]: + """List userSessions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserSessionList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('UserSessionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions'} # type: ignore + + async def disconnect( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs: Any + ) -> None: + """Disconnect a userSession. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.disconnect.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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, {}) + + disconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect'} # type: ignore + + async def send_message( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + send_message: Optional["_models.SendMessage"] = None, + **kwargs: Any + ) -> None: + """Send a message to a user. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :param send_message: Object containing message includes title and message body. + :type send_message: ~desktop_virtualization_api_client.models.SendMessage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.send_message.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if send_message is not None: + body_content = self._serialize.body(send_message, 'SendMessage') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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, {}) + + send_message.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py new file mode 100644 index 000000000000..5898aa71c78f --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/aio/operations/_workspaces_operations.py @@ -0,0 +1,430 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspacesOperations: + """WorkspacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> "_models.Workspace": + """Get a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **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('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + workspace: "_models.Workspace", + **kwargs: Any + ) -> "_models.Workspace": + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param workspace: Object containing Workspace definitions. + :type workspace: ~desktop_virtualization_api_client.models.Workspace + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(workspace, 'Workspace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + **kwargs: Any + ) -> None: + """Remove a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + workspace_name: str, + workspace: Optional["_models.WorkspacePatch"] = None, + **kwargs: Any + ) -> "_models.Workspace": + """Update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param workspace: Object containing Workspace definitions. + :type workspace: ~desktop_virtualization_api_client.models.WorkspacePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if workspace is not None: + body_content = self._serialize.body(workspace, 'WorkspacePatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + 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('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceList"]: + """List workspaces. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore + + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.WorkspaceList"]: + """List workspaces in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **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 + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py new file mode 100644 index 000000000000..cf41bbdc9aa6 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/__init__.py @@ -0,0 +1,261 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import Application + from ._models_py3 import ApplicationGroup + from ._models_py3 import ApplicationGroupList + from ._models_py3 import ApplicationGroupPatch + from ._models_py3 import ApplicationList + from ._models_py3 import ApplicationPatch + from ._models_py3 import CloudErrorProperties + from ._models_py3 import Desktop + from ._models_py3 import DesktopList + from ._models_py3 import DesktopPatch + from ._models_py3 import ExpandMsixImage + from ._models_py3 import ExpandMsixImageList + from ._models_py3 import HostPool + from ._models_py3 import HostPoolList + from ._models_py3 import HostPoolPatch + from ._models_py3 import Identity + from ._models_py3 import LogSpecification + from ._models_py3 import MSIXImageURI + from ._models_py3 import MSIXPackage + from ._models_py3 import MSIXPackageList + from ._models_py3 import MSIXPackagePatch + from ._models_py3 import MigrationRequestProperties + from ._models_py3 import MsixPackageApplications + from ._models_py3 import MsixPackageDependencies + from ._models_py3 import OperationProperties + from ._models_py3 import Plan + from ._models_py3 import PrivateEndpoint + from ._models_py3 import PrivateEndpointConnection + from ._models_py3 import PrivateEndpointConnectionListResultWithSystemData + from ._models_py3 import PrivateEndpointConnectionWithSystemData + from ._models_py3 import PrivateLinkResource + from ._models_py3 import PrivateLinkResourceListResult + from ._models_py3 import PrivateLinkServiceConnectionState + from ._models_py3 import RegistrationInfo + from ._models_py3 import RegistrationInfoPatch + from ._models_py3 import Resource + from ._models_py3 import ResourceModelWithAllowedPropertySet + from ._models_py3 import ResourceModelWithAllowedPropertySetIdentity + from ._models_py3 import ResourceModelWithAllowedPropertySetPlan + from ._models_py3 import ResourceModelWithAllowedPropertySetSku + from ._models_py3 import ResourceProviderOperation + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import ResourceProviderOperationList + from ._models_py3 import ScalingHostPoolReference + from ._models_py3 import ScalingPlan + from ._models_py3 import ScalingPlanList + from ._models_py3 import ScalingPlanPatch + from ._models_py3 import ScalingSchedule + from ._models_py3 import SendMessage + from ._models_py3 import ServiceSpecification + from ._models_py3 import SessionHost + from ._models_py3 import SessionHostHealthCheckFailureDetails + from ._models_py3 import SessionHostHealthCheckReport + from ._models_py3 import SessionHostList + from ._models_py3 import SessionHostPatch + from ._models_py3 import Sku + from ._models_py3 import StartMenuItem + from ._models_py3 import StartMenuItemList + from ._models_py3 import SystemData + from ._models_py3 import Time + from ._models_py3 import UserSession + from ._models_py3 import UserSessionList + from ._models_py3 import Workspace + from ._models_py3 import WorkspaceList + from ._models_py3 import WorkspacePatch +except (SyntaxError, ImportError): + from ._models import Application # type: ignore + from ._models import ApplicationGroup # type: ignore + from ._models import ApplicationGroupList # type: ignore + from ._models import ApplicationGroupPatch # type: ignore + from ._models import ApplicationList # type: ignore + from ._models import ApplicationPatch # type: ignore + from ._models import CloudErrorProperties # type: ignore + from ._models import Desktop # type: ignore + from ._models import DesktopList # type: ignore + from ._models import DesktopPatch # type: ignore + from ._models import ExpandMsixImage # type: ignore + from ._models import ExpandMsixImageList # type: ignore + from ._models import HostPool # type: ignore + from ._models import HostPoolList # type: ignore + from ._models import HostPoolPatch # type: ignore + from ._models import Identity # type: ignore + from ._models import LogSpecification # type: ignore + from ._models import MSIXImageURI # type: ignore + from ._models import MSIXPackage # type: ignore + from ._models import MSIXPackageList # type: ignore + from ._models import MSIXPackagePatch # type: ignore + from ._models import MigrationRequestProperties # type: ignore + from ._models import MsixPackageApplications # type: ignore + from ._models import MsixPackageDependencies # type: ignore + from ._models import OperationProperties # type: ignore + from ._models import Plan # type: ignore + from ._models import PrivateEndpoint # type: ignore + from ._models import PrivateEndpointConnection # type: ignore + from ._models import PrivateEndpointConnectionListResultWithSystemData # type: ignore + from ._models import PrivateEndpointConnectionWithSystemData # type: ignore + from ._models import PrivateLinkResource # type: ignore + from ._models import PrivateLinkResourceListResult # type: ignore + from ._models import PrivateLinkServiceConnectionState # type: ignore + from ._models import RegistrationInfo # type: ignore + from ._models import RegistrationInfoPatch # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceModelWithAllowedPropertySet # type: ignore + from ._models import ResourceModelWithAllowedPropertySetIdentity # type: ignore + from ._models import ResourceModelWithAllowedPropertySetPlan # type: ignore + from ._models import ResourceModelWithAllowedPropertySetSku # type: ignore + from ._models import ResourceProviderOperation # type: ignore + from ._models import ResourceProviderOperationDisplay # type: ignore + from ._models import ResourceProviderOperationList # type: ignore + from ._models import ScalingHostPoolReference # type: ignore + from ._models import ScalingPlan # type: ignore + from ._models import ScalingPlanList # type: ignore + from ._models import ScalingPlanPatch # type: ignore + from ._models import ScalingSchedule # type: ignore + from ._models import SendMessage # type: ignore + from ._models import ServiceSpecification # type: ignore + from ._models import SessionHost # type: ignore + from ._models import SessionHostHealthCheckFailureDetails # type: ignore + from ._models import SessionHostHealthCheckReport # type: ignore + from ._models import SessionHostList # type: ignore + from ._models import SessionHostPatch # type: ignore + from ._models import Sku # type: ignore + from ._models import StartMenuItem # type: ignore + from ._models import StartMenuItemList # type: ignore + from ._models import SystemData # type: ignore + from ._models import Time # type: ignore + from ._models import UserSession # type: ignore + from ._models import UserSessionList # type: ignore + from ._models import Workspace # type: ignore + from ._models import WorkspaceList # type: ignore + from ._models import WorkspacePatch # type: ignore + +from ._desktop_virtualization_api_client_enums import ( + ApplicationGroupType, + ApplicationType, + CommandLineSetting, + CreatedByType, + HealthCheckName, + HealthCheckResult, + HostPoolType, + LoadBalancerType, + Operation, + PersonalDesktopAssignmentType, + PreferredAppGroupType, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + PublicNetworkAccess, + RegistrationTokenOperation, + RemoteApplicationType, + SSOSecretType, + ScalingHostPoolType, + ScalingScheduleDaysOfWeekItem, + SessionHostLoadBalancingAlgorithm, + SessionState, + SkuTier, + Status, + StopHostsWhen, + UpdateState, +) + +__all__ = [ + 'Application', + 'ApplicationGroup', + 'ApplicationGroupList', + 'ApplicationGroupPatch', + 'ApplicationList', + 'ApplicationPatch', + 'CloudErrorProperties', + 'Desktop', + 'DesktopList', + 'DesktopPatch', + 'ExpandMsixImage', + 'ExpandMsixImageList', + 'HostPool', + 'HostPoolList', + 'HostPoolPatch', + 'Identity', + 'LogSpecification', + 'MSIXImageURI', + 'MSIXPackage', + 'MSIXPackageList', + 'MSIXPackagePatch', + 'MigrationRequestProperties', + 'MsixPackageApplications', + 'MsixPackageDependencies', + 'OperationProperties', + 'Plan', + 'PrivateEndpoint', + 'PrivateEndpointConnection', + 'PrivateEndpointConnectionListResultWithSystemData', + 'PrivateEndpointConnectionWithSystemData', + 'PrivateLinkResource', + 'PrivateLinkResourceListResult', + 'PrivateLinkServiceConnectionState', + 'RegistrationInfo', + 'RegistrationInfoPatch', + 'Resource', + 'ResourceModelWithAllowedPropertySet', + 'ResourceModelWithAllowedPropertySetIdentity', + 'ResourceModelWithAllowedPropertySetPlan', + 'ResourceModelWithAllowedPropertySetSku', + 'ResourceProviderOperation', + 'ResourceProviderOperationDisplay', + 'ResourceProviderOperationList', + 'ScalingHostPoolReference', + 'ScalingPlan', + 'ScalingPlanList', + 'ScalingPlanPatch', + 'ScalingSchedule', + 'SendMessage', + 'ServiceSpecification', + 'SessionHost', + 'SessionHostHealthCheckFailureDetails', + 'SessionHostHealthCheckReport', + 'SessionHostList', + 'SessionHostPatch', + 'Sku', + 'StartMenuItem', + 'StartMenuItemList', + 'SystemData', + 'Time', + 'UserSession', + 'UserSessionList', + 'Workspace', + 'WorkspaceList', + 'WorkspacePatch', + 'ApplicationGroupType', + 'ApplicationType', + 'CommandLineSetting', + 'CreatedByType', + 'HealthCheckName', + 'HealthCheckResult', + 'HostPoolType', + 'LoadBalancerType', + 'Operation', + 'PersonalDesktopAssignmentType', + 'PreferredAppGroupType', + 'PrivateEndpointConnectionProvisioningState', + 'PrivateEndpointServiceConnectionStatus', + 'PublicNetworkAccess', + 'RegistrationTokenOperation', + 'RemoteApplicationType', + 'SSOSecretType', + 'ScalingHostPoolType', + 'ScalingScheduleDaysOfWeekItem', + 'SessionHostLoadBalancingAlgorithm', + 'SessionState', + 'SkuTier', + 'Status', + 'StopHostsWhen', + 'UpdateState', +] diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py new file mode 100644 index 000000000000..493339676783 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py @@ -0,0 +1,327 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, EnumMeta +from six import with_metaclass + +class _CaseInsensitiveEnumMeta(EnumMeta): + def __getitem__(self, name): + return super().__getitem__(name.upper()) + + def __getattr__(cls, name): + """Return the enum member matching `name` + We use __getattr__ instead of descriptors or inserting into the enum + class' __dict__ in order to support `name` and `value` being both + properties for enum members (which live in the class' __dict__) and + enum members themselves. + """ + try: + return cls._member_map_[name.upper()] + except KeyError: + raise AttributeError(name) + + +class ApplicationGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource Type of ApplicationGroup. + """ + + REMOTE_APP = "RemoteApp" + DESKTOP = "Desktop" + +class ApplicationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Application type of application. + """ + + REMOTE_APP = "RemoteApp" + DESKTOP = "Desktop" + +class CommandLineSetting(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies whether this published application can be launched with command line arguments + provided by the client, command line arguments specified at publish time, or no command line + arguments at all. + """ + + DO_NOT_ALLOW = "DoNotAllow" + ALLOW = "Allow" + REQUIRE = "Require" + +class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class HealthCheckName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Represents the name of the health check operation performed. + """ + + #: Verifies the SessionHost is joined to a domain. If this check fails is classified as fatal as + #: no connection can succeed if the SessionHost is not joined to the domain. + DOMAIN_JOINED_CHECK = "DomainJoinedCheck" + #: Verifies the SessionHost is not experiencing domain trust issues that will prevent + #: authentication on SessionHost at connection time when session is created. If this check fails + #: is classified as fatal as no connection can succeed if we cannot reach the domain for + #: authentication on the SessionHost. + DOMAIN_TRUST_CHECK = "DomainTrustCheck" + #: Verifies the FSLogix service is up and running to make sure users' profiles are loaded in the + #: session. If this check fails is classified as fatal as even if the connection can succeed, user + #: experience is bad as the user profile cannot be loaded and user will get a temporary profile in + #: the session. + FS_LOGIX_HEALTH_CHECK = "FSLogixHealthCheck" + #: Verifies that the SxS stack is up and running so connections can succeed. If this check fails + #: is classified as fatal as no connection can succeed if the SxS stack is not ready. + SX_S_STACK_LISTENER_CHECK = "SxSStackListenerCheck" + #: Verifies that the required WVD service and Geneva URLs are reachable from the SessionHost. + #: These URLs are: RdTokenUri, RdBrokerURI, RdDiagnosticsUri and storage blob URLs for agent + #: monitoring (geneva). If this check fails, it is non fatal and the machine still can service + #: connections, main issue may be that monitoring agent is unable to store warm path data (logs, + #: operations ...). + URLS_ACCESSIBLE_CHECK = "UrlsAccessibleCheck" + #: Verifies that the required Geneva agent is running. If this check fails, it is non fatal and + #: the machine still can service connections, main issue may be that monitoring agent is missing + #: or running (possibly) older version. + MONITORING_AGENT_CHECK = "MonitoringAgentCheck" + #: Verifies the domain the SessionHost is joined to is still reachable. If this check fails is + #: classified as fatal as no connection can succeed if the domain the SessionHost is joined is not + #: reachable at the time of connection. + DOMAIN_REACHABLE = "DomainReachable" + #: Verifies whether the WebRTCRedirector component is healthy. The WebRTCRedirector component is + #: used to optimize video and audio performance in Microsoft Teams. This checks whether the + #: component is still running, and whether there is a higher version available. If this check + #: fails, it is non fatal and the machine still can service connections, main issue may be the + #: WebRTCRedirector component has to be restarted or updated. + WEB_RTC_REDIRECTOR_CHECK = "WebRTCRedirectorCheck" + #: Verifies the value of SecurityLayer registration key. If the value is 0 (SecurityLayer.RDP) + #: this check fails with Error code = NativeMethodErrorCode.E_FAIL and is fatal. If the value is 1 + #: (SecurityLayer.Negotiate) this check fails with Error code = + #: NativeMethodErrorCode.ERROR_SUCCESS and is non fatal. + SUPPORTED_ENCRYPTION_CHECK = "SupportedEncryptionCheck" + #: Verifies the metadata service is accessible and return compute properties. + META_DATA_SERVICE_CHECK = "MetaDataServiceCheck" + #: Verifies that the AppAttachService is healthy (there were no issues during package staging). + #: The AppAttachService is used to enable the staging/registration (and eventual + #: deregistration/destaging) of MSIX apps that have been set up by the tenant admin. This checks + #: whether the component had any failures during package staging. Failures in staging will prevent + #: some MSIX apps from working properly for the end user. If this check fails, it is non fatal and + #: the machine still can service connections, main issue may be certain apps will not work for + #: end-users. + APP_ATTACH_HEALTH_CHECK = "AppAttachHealthCheck" + +class HealthCheckResult(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Represents the Health state of the health check we performed. + """ + + #: Health check result is not currently known. + UNKNOWN = "Unknown" + #: Health check passed. + HEALTH_CHECK_SUCCEEDED = "HealthCheckSucceeded" + #: Health check failed. + HEALTH_CHECK_FAILED = "HealthCheckFailed" + #: We received a Shutdown notification. + SESSION_HOST_SHUTDOWN = "SessionHostShutdown" + +class HostPoolType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """HostPool type for desktop. + """ + + #: 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. + PERSONAL = "Personal" + #: Users get a new (random) SessionHost every time it connects to the HostPool. + POOLED = "Pooled" + #: Users assign their own machines, load balancing logic remains the same as Personal. + #: PersonalDesktopAssignmentType must be Direct. + BYO_DESKTOP = "BYODesktop" + +class LoadBalancerType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of the load balancer. + """ + + BREADTH_FIRST = "BreadthFirst" + DEPTH_FIRST = "DepthFirst" + PERSISTENT = "Persistent" + +class Operation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of operation for migration. + """ + + #: Start the migration. + START = "Start" + #: Revoke the migration. + REVOKE = "Revoke" + #: Complete the migration. + COMPLETE = "Complete" + #: Hide the hostpool. + HIDE = "Hide" + #: Unhide the hostpool. + UNHIDE = "Unhide" + +class PersonalDesktopAssignmentType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """PersonalDesktopAssignment type for HostPool. + """ + + AUTOMATIC = "Automatic" + DIRECT = "Direct" + +class PreferredAppGroupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of preferred application group type, default to Desktop Application Group + """ + + NONE = "None" + DESKTOP = "Desktop" + RAIL_APPLICATIONS = "RailApplications" + +class PrivateEndpointConnectionProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The current provisioning state. + """ + + SUCCEEDED = "Succeeded" + CREATING = "Creating" + DELETING = "Deleting" + FAILED = "Failed" + +class PrivateEndpointServiceConnectionStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The private endpoint connection status. + """ + + PENDING = "Pending" + APPROVED = "Approved" + REJECTED = "Rejected" + +class PublicNetworkAccess(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enabled allows this resource to be accessed from both public and private networks, Disabled + allows this resource to only be accessed via private endpoints + """ + + ENABLED = "Enabled" + DISABLED = "Disabled" + +class RegistrationTokenOperation(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of resetting the token. + """ + + DELETE = "Delete" + NONE = "None" + UPDATE = "Update" + +class RemoteApplicationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Resource Type of Application. + """ + + IN_BUILT = "InBuilt" + MSIX_APPLICATION = "MsixApplication" + +class ScalingHostPoolType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """HostPool type for desktop. + """ + + #: Users get a new (random) SessionHost every time it connects to the HostPool. + POOLED = "Pooled" + +class ScalingScheduleDaysOfWeekItem(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + + SUNDAY = "Sunday" + MONDAY = "Monday" + TUESDAY = "Tuesday" + WEDNESDAY = "Wednesday" + THURSDAY = "Thursday" + FRIDAY = "Friday" + SATURDAY = "Saturday" + +class SessionHostLoadBalancingAlgorithm(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Load balancing algorithm for ramp up period. + """ + + BREADTH_FIRST = "BreadthFirst" + DEPTH_FIRST = "DepthFirst" + +class SessionState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """State of user session. + """ + + UNKNOWN = "Unknown" + ACTIVE = "Active" + DISCONNECTED = "Disconnected" + PENDING = "Pending" + LOG_OFF = "LogOff" + USER_PROFILE_DISK_MOUNTED = "UserProfileDiskMounted" + +class SkuTier(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """This field is required to be implemented by the Resource Provider if the service has more than + one tier, but is not required on a PUT. + """ + + FREE = "Free" + BASIC = "Basic" + STANDARD = "Standard" + PREMIUM = "Premium" + +class SSOSecretType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of single sign on Secret Type. + """ + + SHARED_KEY = "SharedKey" + CERTIFICATE = "Certificate" + SHARED_KEY_IN_KEY_VAULT = "SharedKeyInKeyVault" + CERTIFICATE_IN_KEY_VAULT = "CertificateInKeyVault" + +class Status(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Status for a SessionHost. + """ + + #: Session Host has passed all the health checks and is available to handle connections. + AVAILABLE = "Available" + #: Session Host is either turned off or has failed critical health checks which is causing service + #: not to be able to route connections to this session host. Note this replaces previous + #: 'NoHeartBeat' status. + UNAVAILABLE = "Unavailable" + #: Session Host is shutdown - RD Agent reported session host to be stopped or deallocated. + SHUTDOWN = "Shutdown" + #: The Session Host is unavailable because it is currently disconnected. + DISCONNECTED = "Disconnected" + #: Session Host is unavailable because currently an upgrade of RDAgent/side-by-side stack is in + #: progress. Note: this state will be removed once the upgrade completes and the host is able to + #: accept connections. + UPGRADING = "Upgrading" + #: Session Host is unavailable because the critical component upgrade (agent, side-by-side stack, + #: etc.) failed. + UPGRADE_FAILED = "UpgradeFailed" + #: The Session Host is not heart beating. + NO_HEARTBEAT = "NoHeartbeat" + #: SessionHost is not joined to domain. + NOT_JOINED_TO_DOMAIN = "NotJoinedToDomain" + #: SessionHost's domain trust relationship lost. + DOMAIN_TRUST_RELATIONSHIP_LOST = "DomainTrustRelationshipLost" + #: SxS stack installed on the SessionHost is not ready to receive connections. + SX_S_STACK_LISTENER_NOT_READY = "SxSStackListenerNotReady" + #: FSLogix is in an unhealthy state on the session host. + FS_LOGIX_NOT_HEALTHY = "FSLogixNotHealthy" + #: New status to inform admins that the health on their endpoint needs to be fixed. The + #: connections might not fail, as these issues are not fatal. + NEEDS_ASSISTANCE = "NeedsAssistance" + +class StopHostsWhen(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies when to stop hosts during ramp down period. + """ + + ZERO_SESSIONS = "ZeroSessions" + ZERO_ACTIVE_SESSIONS = "ZeroActiveSessions" + +class UpdateState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Update state of a SessionHost. + """ + + INITIAL = "Initial" + PENDING = "Pending" + STARTED = "Started" + SUCCEEDED = "Succeeded" + FAILED = "Failed" diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models.py new file mode 100644 index 000000000000..ddf752c9348e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models.py @@ -0,0 +1,3114 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import msrest.serialization + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Application(Resource): + """Schema for Application properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of Application. (internal use). + :vartype object_id: str + :param description: Description of Application. + :type description: str + :param friendly_name: Friendly name of Application. + :type friendly_name: str + :param file_path: Specifies a path for the executable file for the application. + :type file_path: str + :param msix_package_family_name: Specifies the package family name for MSIX applications. + :type msix_package_family_name: str + :param msix_package_application_id: Specifies the package application Id for MSIX applications. + :type msix_package_application_id: str + :param application_type: Resource Type of Application. Possible values include: "InBuilt", + "MsixApplication". + :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType + :param command_line_setting: Required. Specifies whether this published application can be + launched with command line arguments provided by the client, command line arguments specified + at publish time, or no command line arguments at all. Possible values include: "DoNotAllow", + "Allow", "Require". + :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting + :param command_line_arguments: Command Line Arguments for Application. + :type command_line_arguments: str + :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + server. + :type show_in_portal: bool + :param icon_path: Path to icon. + :type icon_path: str + :param icon_index: Index of the icon. + :type icon_index: int + :ivar icon_hash: Hash of the icon. + :vartype icon_hash: str + :ivar icon_content: the icon a 64 bit string as a byte array. + :vartype icon_content: bytearray + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'command_line_setting': {'required': True}, + 'icon_hash': {'readonly': True}, + 'icon_content': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'file_path': {'key': 'properties.filePath', 'type': 'str'}, + 'msix_package_family_name': {'key': 'properties.msixPackageFamilyName', 'type': 'str'}, + 'msix_package_application_id': {'key': 'properties.msixPackageApplicationId', 'type': 'str'}, + 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, + 'command_line_setting': {'key': 'properties.commandLineSetting', 'type': 'str'}, + 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, + 'show_in_portal': {'key': 'properties.showInPortal', 'type': 'bool'}, + 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, + 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, + 'icon_hash': {'key': 'properties.iconHash', 'type': 'str'}, + 'icon_content': {'key': 'properties.iconContent', 'type': 'bytearray'}, + } + + def __init__( + self, + **kwargs + ): + super(Application, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.file_path = kwargs.get('file_path', None) + self.msix_package_family_name = kwargs.get('msix_package_family_name', None) + self.msix_package_application_id = kwargs.get('msix_package_application_id', None) + self.application_type = kwargs.get('application_type', None) + self.command_line_setting = kwargs['command_line_setting'] + self.command_line_arguments = kwargs.get('command_line_arguments', None) + self.show_in_portal = kwargs.get('show_in_portal', None) + self.icon_path = kwargs.get('icon_path', None) + self.icon_index = kwargs.get('icon_index', None) + self.icon_hash = None + self.icon_content = None + + +class ResourceModelWithAllowedPropertySet(msrest.serialization.Model): + """The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceModelWithAllowedPropertySet, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = kwargs.get('location', None) + self.managed_by = kwargs.get('managed_by', None) + self.kind = kwargs.get('kind', None) + self.etag = None + self.tags = kwargs.get('tags', None) + self.identity = kwargs.get('identity', None) + self.sku = kwargs.get('sku', None) + self.plan = kwargs.get('plan', None) + + +class ApplicationGroup(ResourceModelWithAllowedPropertySet): + """Represents a ApplicationGroup definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of ApplicationGroup. (internal use). + :vartype object_id: str + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_name: str + :param host_pool_arm_path: Required. HostPool arm path of ApplicationGroup. + :type host_pool_arm_path: str + :ivar workspace_arm_path: Workspace arm path of ApplicationGroup. + :vartype workspace_arm_path: str + :param application_group_type: Required. Resource Type of ApplicationGroup. Possible values + include: "RemoteApp", "Desktop". + :type application_group_type: str or + ~desktop_virtualization_api_client.models.ApplicationGroupType + :param migration_request: The registration info of HostPool. + :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties + :ivar cloud_pc_resource: Is cloud pc resource. + :vartype cloud_pc_resource: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'host_pool_arm_path': {'required': True}, + 'workspace_arm_path': {'readonly': True}, + 'application_group_type': {'required': True}, + 'cloud_pc_resource': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'host_pool_arm_path': {'key': 'properties.hostPoolArmPath', 'type': 'str'}, + 'workspace_arm_path': {'key': 'properties.workspaceArmPath', 'type': 'str'}, + 'application_group_type': {'key': 'properties.applicationGroupType', 'type': 'str'}, + 'migration_request': {'key': 'properties.migrationRequest', 'type': 'MigrationRequestProperties'}, + 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationGroup, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.host_pool_arm_path = kwargs['host_pool_arm_path'] + self.workspace_arm_path = None + self.application_group_type = kwargs['application_group_type'] + self.migration_request = kwargs.get('migration_request', None) + self.cloud_pc_resource = None + + +class ApplicationGroupList(msrest.serialization.Model): + """List of ApplicationGroup definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of ApplicationGroup definitions. + :type value: list[~desktop_virtualization_api_client.models.ApplicationGroup] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationGroupList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ApplicationGroupPatch(Resource): + """ApplicationGroup properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationGroupPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + + +class ApplicationList(msrest.serialization.Model): + """List of Application definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Application definitions. + :type value: list[~desktop_virtualization_api_client.models.Application] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Application]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ApplicationPatch(msrest.serialization.Model): + """Application properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of Application. + :type description: str + :param friendly_name: Friendly name of Application. + :type friendly_name: str + :param file_path: Specifies a path for the executable file for the application. + :type file_path: str + :param command_line_setting: Specifies whether this published application can be launched with + command line arguments provided by the client, command line arguments specified at publish + time, or no command line arguments at all. Possible values include: "DoNotAllow", "Allow", + "Require". + :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting + :param command_line_arguments: Command Line Arguments for Application. + :type command_line_arguments: str + :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + server. + :type show_in_portal: bool + :param icon_path: Path to icon. + :type icon_path: str + :param icon_index: Index of the icon. + :type icon_index: int + :param msix_package_family_name: Specifies the package family name for MSIX applications. + :type msix_package_family_name: str + :param msix_package_application_id: Specifies the package application Id for MSIX applications. + :type msix_package_application_id: str + :param application_type: Resource Type of Application. Possible values include: "InBuilt", + "MsixApplication". + :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'file_path': {'key': 'properties.filePath', 'type': 'str'}, + 'command_line_setting': {'key': 'properties.commandLineSetting', 'type': 'str'}, + 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, + 'show_in_portal': {'key': 'properties.showInPortal', 'type': 'bool'}, + 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, + 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, + 'msix_package_family_name': {'key': 'properties.msixPackageFamilyName', 'type': 'str'}, + 'msix_package_application_id': {'key': 'properties.msixPackageApplicationId', 'type': 'str'}, + 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.file_path = kwargs.get('file_path', None) + self.command_line_setting = kwargs.get('command_line_setting', None) + self.command_line_arguments = kwargs.get('command_line_arguments', None) + self.show_in_portal = kwargs.get('show_in_portal', None) + self.icon_path = kwargs.get('icon_path', None) + self.icon_index = kwargs.get('icon_index', None) + self.msix_package_family_name = kwargs.get('msix_package_family_name', None) + self.msix_package_application_id = kwargs.get('msix_package_application_id', None) + self.application_type = kwargs.get('application_type', None) + + +class CloudErrorProperties(msrest.serialization.Model): + """Cloud error object properties. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CloudErrorProperties, self).__init__(**kwargs) + self.code = kwargs.get('code', None) + self.message = kwargs.get('message', None) + + +class Desktop(Resource): + """Schema for Desktop properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of Desktop. (internal use). + :vartype object_id: str + :param description: Description of Desktop. + :type description: str + :param friendly_name: Friendly name of Desktop. + :type friendly_name: str + :ivar icon_hash: Hash of the icon. + :vartype icon_hash: str + :ivar icon_content: The icon a 64 bit string as a byte array. + :vartype icon_content: bytearray + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'icon_hash': {'readonly': True}, + 'icon_content': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'icon_hash': {'key': 'properties.iconHash', 'type': 'str'}, + 'icon_content': {'key': 'properties.iconContent', 'type': 'bytearray'}, + } + + def __init__( + self, + **kwargs + ): + super(Desktop, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.icon_hash = None + self.icon_content = None + + +class DesktopList(msrest.serialization.Model): + """List of Desktop definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Desktop definitions. + :type value: list[~desktop_virtualization_api_client.models.Desktop] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Desktop]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DesktopList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class DesktopPatch(msrest.serialization.Model): + """Desktop properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of Desktop. + :type description: str + :param friendly_name: Friendly name of Desktop. + :type friendly_name: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(DesktopPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + + +class ExpandMsixImage(Resource): + """Represents the definition of contents retrieved after expanding the MSIX Image. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param package_alias: Alias of MSIX Package. + :type package_alias: str + :param image_path: VHD/CIM image path on Network Share. + :type image_path: str + :param package_name: Package Name from appxmanifest.xml. + :type package_name: str + :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :type package_family_name: str + :param package_full_name: Package Full Name from appxmanifest.xml. + :type package_full_name: str + :param display_name: User friendly Name to be displayed in the portal. + :type display_name: str + :param package_relative_path: Relative Path to the package inside the image. + :type package_relative_path: str + :param is_regular_registration: Specifies how to register Package in feed. + :type is_regular_registration: bool + :param is_active: Make this version of the package the active one across the hostpool. + :type is_active: bool + :param package_dependencies: List of package dependencies. + :type package_dependencies: + list[~desktop_virtualization_api_client.models.MsixPackageDependencies] + :param version: Package Version found in the appxmanifest.xml. + :type version: str + :param last_updated: Date Package was last updated, found in the appxmanifest.xml. + :type last_updated: ~datetime.datetime + :param package_applications: List of package applications. + :type package_applications: + list[~desktop_virtualization_api_client.models.MsixPackageApplications] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'package_alias': {'key': 'properties.packageAlias', 'type': 'str'}, + 'image_path': {'key': 'properties.imagePath', 'type': 'str'}, + 'package_name': {'key': 'properties.packageName', 'type': 'str'}, + 'package_family_name': {'key': 'properties.packageFamilyName', 'type': 'str'}, + 'package_full_name': {'key': 'properties.packageFullName', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'package_relative_path': {'key': 'properties.packageRelativePath', 'type': 'str'}, + 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, + 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, + 'package_dependencies': {'key': 'properties.packageDependencies', 'type': '[MsixPackageDependencies]'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'last_updated': {'key': 'properties.lastUpdated', 'type': 'iso-8601'}, + 'package_applications': {'key': 'properties.packageApplications', 'type': '[MsixPackageApplications]'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpandMsixImage, self).__init__(**kwargs) + self.package_alias = kwargs.get('package_alias', None) + self.image_path = kwargs.get('image_path', None) + self.package_name = kwargs.get('package_name', None) + self.package_family_name = kwargs.get('package_family_name', None) + self.package_full_name = kwargs.get('package_full_name', None) + self.display_name = kwargs.get('display_name', None) + self.package_relative_path = kwargs.get('package_relative_path', None) + self.is_regular_registration = kwargs.get('is_regular_registration', None) + self.is_active = kwargs.get('is_active', None) + self.package_dependencies = kwargs.get('package_dependencies', None) + self.version = kwargs.get('version', None) + self.last_updated = kwargs.get('last_updated', None) + self.package_applications = kwargs.get('package_applications', None) + + +class ExpandMsixImageList(msrest.serialization.Model): + """List of MSIX package properties retrieved from MSIX Image expansion. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of MSIX package properties from give MSIX Image. + :type value: list[~desktop_virtualization_api_client.models.ExpandMsixImage] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExpandMsixImage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ExpandMsixImageList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class HostPool(ResourceModelWithAllowedPropertySet): + """Represents a HostPool definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of HostPool. (internal use). + :vartype object_id: str + :param friendly_name: Friendly name of HostPool. + :type friendly_name: str + :param description: Description of HostPool. + :type description: str + :param host_pool_type: Required. HostPool type for desktop. Possible values include: + "Personal", "Pooled", "BYODesktop". + :type host_pool_type: str or ~desktop_virtualization_api_client.models.HostPoolType + :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible + values include: "Automatic", "Direct". + :type personal_desktop_assignment_type: str or + ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType + :param custom_rdp_property: Custom rdp property of HostPool. + :type custom_rdp_property: str + :param max_session_limit: The max session limit of HostPool. + :type max_session_limit: int + :param load_balancer_type: Required. The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType + :param ring: The ring number of HostPool. + :type ring: int + :param validation_environment: Is validation environment. + :type validation_environment: bool + :param registration_info: The registration info of HostPool. + :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfo + :param vm_template: VM template for sessionhosts configuration within hostpool. + :type vm_template: str + :ivar application_group_references: List of applicationGroup links. + :vartype application_group_references: list[str] + :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :type ssoadfs_authority: str + :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + certificates. + :type sso_client_id: str + :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + communication to ADFS. + :type sso_client_secret_key_vault_path: str + :param sso_secret_type: The type of single sign on Secret Type. Possible values include: + "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". + :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType + :param preferred_app_group_type: Required. The type of preferred application group type, + default to Desktop Application Group. Possible values include: "None", "Desktop", + "RailApplications". + :type preferred_app_group_type: str or + ~desktop_virtualization_api_client.models.PreferredAppGroupType + :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :type start_vm_on_connect: bool + :param migration_request: The registration info of HostPool. + :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties + :ivar cloud_pc_resource: Is cloud pc resource. + :vartype cloud_pc_resource: bool + :param public_network_access: Enabled allows this resource to be accessed from both public and + private networks, Disabled allows this resource to only be accessed via private endpoints. + Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'host_pool_type': {'required': True}, + 'load_balancer_type': {'required': True}, + 'application_group_references': {'readonly': True}, + 'preferred_app_group_type': {'required': True}, + 'cloud_pc_resource': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'host_pool_type': {'key': 'properties.hostPoolType', 'type': 'str'}, + 'personal_desktop_assignment_type': {'key': 'properties.personalDesktopAssignmentType', 'type': 'str'}, + 'custom_rdp_property': {'key': 'properties.customRdpProperty', 'type': 'str'}, + 'max_session_limit': {'key': 'properties.maxSessionLimit', 'type': 'int'}, + 'load_balancer_type': {'key': 'properties.loadBalancerType', 'type': 'str'}, + 'ring': {'key': 'properties.ring', 'type': 'int'}, + 'validation_environment': {'key': 'properties.validationEnvironment', 'type': 'bool'}, + 'registration_info': {'key': 'properties.registrationInfo', 'type': 'RegistrationInfo'}, + 'vm_template': {'key': 'properties.vmTemplate', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + 'ssoadfs_authority': {'key': 'properties.ssoadfsAuthority', 'type': 'str'}, + 'sso_client_id': {'key': 'properties.ssoClientId', 'type': 'str'}, + 'sso_client_secret_key_vault_path': {'key': 'properties.ssoClientSecretKeyVaultPath', 'type': 'str'}, + 'sso_secret_type': {'key': 'properties.ssoSecretType', 'type': 'str'}, + 'preferred_app_group_type': {'key': 'properties.preferredAppGroupType', 'type': 'str'}, + 'start_vm_on_connect': {'key': 'properties.startVMOnConnect', 'type': 'bool'}, + 'migration_request': {'key': 'properties.migrationRequest', 'type': 'MigrationRequestProperties'}, + 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HostPool, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.friendly_name = kwargs.get('friendly_name', None) + self.description = kwargs.get('description', None) + self.host_pool_type = kwargs['host_pool_type'] + self.personal_desktop_assignment_type = kwargs.get('personal_desktop_assignment_type', None) + self.custom_rdp_property = kwargs.get('custom_rdp_property', None) + self.max_session_limit = kwargs.get('max_session_limit', None) + self.load_balancer_type = kwargs['load_balancer_type'] + self.ring = kwargs.get('ring', None) + self.validation_environment = kwargs.get('validation_environment', None) + self.registration_info = kwargs.get('registration_info', None) + self.vm_template = kwargs.get('vm_template', None) + self.application_group_references = None + self.ssoadfs_authority = kwargs.get('ssoadfs_authority', None) + self.sso_client_id = kwargs.get('sso_client_id', None) + self.sso_client_secret_key_vault_path = kwargs.get('sso_client_secret_key_vault_path', None) + self.sso_secret_type = kwargs.get('sso_secret_type', None) + self.preferred_app_group_type = kwargs['preferred_app_group_type'] + self.start_vm_on_connect = kwargs.get('start_vm_on_connect', None) + self.migration_request = kwargs.get('migration_request', None) + self.cloud_pc_resource = None + self.public_network_access = kwargs.get('public_network_access', None) + + +class HostPoolList(msrest.serialization.Model): + """List of HostPool definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of HostPool definitions. + :type value: list[~desktop_virtualization_api_client.models.HostPool] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HostPoolList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class HostPoolPatch(Resource): + """HostPool properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param friendly_name: Friendly name of HostPool. + :type friendly_name: str + :param description: Description of HostPool. + :type description: str + :param custom_rdp_property: Custom rdp property of HostPool. + :type custom_rdp_property: str + :param max_session_limit: The max session limit of HostPool. + :type max_session_limit: int + :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible + values include: "Automatic", "Direct". + :type personal_desktop_assignment_type: str or + ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType + :param ring: The ring number of HostPool. + :type ring: int + :param validation_environment: Is validation environment. + :type validation_environment: bool + :param registration_info: The registration info of HostPool. + :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfoPatch + :param vm_template: VM template for sessionhosts configuration within hostpool. + :type vm_template: str + :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :type ssoadfs_authority: str + :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + certificates. + :type sso_client_id: str + :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + communication to ADFS. + :type sso_client_secret_key_vault_path: str + :param sso_secret_type: The type of single sign on Secret Type. Possible values include: + "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". + :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType + :param preferred_app_group_type: The type of preferred application group type, default to + Desktop Application Group. Possible values include: "None", "Desktop", "RailApplications". + :type preferred_app_group_type: str or + ~desktop_virtualization_api_client.models.PreferredAppGroupType + :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :type start_vm_on_connect: bool + :param public_network_access: Enabled to allow this resource to be access from the public + network. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'custom_rdp_property': {'key': 'properties.customRdpProperty', 'type': 'str'}, + 'max_session_limit': {'key': 'properties.maxSessionLimit', 'type': 'int'}, + 'personal_desktop_assignment_type': {'key': 'properties.personalDesktopAssignmentType', 'type': 'str'}, + 'load_balancer_type': {'key': 'properties.loadBalancerType', 'type': 'str'}, + 'ring': {'key': 'properties.ring', 'type': 'int'}, + 'validation_environment': {'key': 'properties.validationEnvironment', 'type': 'bool'}, + 'registration_info': {'key': 'properties.registrationInfo', 'type': 'RegistrationInfoPatch'}, + 'vm_template': {'key': 'properties.vmTemplate', 'type': 'str'}, + 'ssoadfs_authority': {'key': 'properties.ssoadfsAuthority', 'type': 'str'}, + 'sso_client_id': {'key': 'properties.ssoClientId', 'type': 'str'}, + 'sso_client_secret_key_vault_path': {'key': 'properties.ssoClientSecretKeyVaultPath', 'type': 'str'}, + 'sso_secret_type': {'key': 'properties.ssoSecretType', 'type': 'str'}, + 'preferred_app_group_type': {'key': 'properties.preferredAppGroupType', 'type': 'str'}, + 'start_vm_on_connect': {'key': 'properties.startVMOnConnect', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HostPoolPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.description = kwargs.get('description', None) + self.custom_rdp_property = kwargs.get('custom_rdp_property', None) + self.max_session_limit = kwargs.get('max_session_limit', None) + self.personal_desktop_assignment_type = kwargs.get('personal_desktop_assignment_type', None) + self.load_balancer_type = kwargs.get('load_balancer_type', None) + self.ring = kwargs.get('ring', None) + self.validation_environment = kwargs.get('validation_environment', None) + self.registration_info = kwargs.get('registration_info', None) + self.vm_template = kwargs.get('vm_template', None) + self.ssoadfs_authority = kwargs.get('ssoadfs_authority', None) + self.sso_client_id = kwargs.get('sso_client_id', None) + self.sso_client_secret_key_vault_path = kwargs.get('sso_client_secret_key_vault_path', None) + self.sso_secret_type = kwargs.get('sso_secret_type', None) + self.preferred_app_group_type = kwargs.get('preferred_app_group_type', None) + self.start_vm_on_connect = kwargs.get('start_vm_on_connect', None) + self.public_network_access = kwargs.get('public_network_access', None) + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type type: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = kwargs.get('type', None) + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display_name = kwargs.get('display_name', None) + self.blob_duration = kwargs.get('blob_duration', None) + + +class MigrationRequestProperties(msrest.serialization.Model): + """Properties for arm migration. + + :param operation: The type of operation for migration. Possible values include: "Start", + "Revoke", "Complete", "Hide", "Unhide". + :type operation: str or ~desktop_virtualization_api_client.models.Operation + :param migration_path: The path to the legacy object to migrate. + :type migration_path: str + """ + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'migration_path': {'key': 'migrationPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MigrationRequestProperties, self).__init__(**kwargs) + self.operation = kwargs.get('operation', None) + self.migration_path = kwargs.get('migration_path', None) + + +class MSIXImageURI(msrest.serialization.Model): + """Represents URI referring to MSIX Image. + + :param uri: URI to Image. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MSIXImageURI, self).__init__(**kwargs) + self.uri = kwargs.get('uri', None) + + +class MSIXPackage(Resource): + """Schema for MSIX Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :param image_path: VHD/CIM image path on Network Share. + :type image_path: str + :param package_name: Package Name from appxmanifest.xml. + :type package_name: str + :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :type package_family_name: str + :param display_name: User friendly Name to be displayed in the portal. + :type display_name: str + :param package_relative_path: Relative Path to the package inside the image. + :type package_relative_path: str + :param is_regular_registration: Specifies how to register Package in feed. + :type is_regular_registration: bool + :param is_active: Make this version of the package the active one across the hostpool. + :type is_active: bool + :param package_dependencies: List of package dependencies. + :type package_dependencies: + list[~desktop_virtualization_api_client.models.MsixPackageDependencies] + :param version: Package Version found in the appxmanifest.xml. + :type version: str + :param last_updated: Date Package was last updated, found in the appxmanifest.xml. + :type last_updated: ~datetime.datetime + :param package_applications: List of package applications. + :type package_applications: + list[~desktop_virtualization_api_client.models.MsixPackageApplications] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'image_path': {'key': 'properties.imagePath', 'type': 'str'}, + 'package_name': {'key': 'properties.packageName', 'type': 'str'}, + 'package_family_name': {'key': 'properties.packageFamilyName', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'package_relative_path': {'key': 'properties.packageRelativePath', 'type': 'str'}, + 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, + 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, + 'package_dependencies': {'key': 'properties.packageDependencies', 'type': '[MsixPackageDependencies]'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'last_updated': {'key': 'properties.lastUpdated', 'type': 'iso-8601'}, + 'package_applications': {'key': 'properties.packageApplications', 'type': '[MsixPackageApplications]'}, + } + + def __init__( + self, + **kwargs + ): + super(MSIXPackage, self).__init__(**kwargs) + self.system_data = None + self.image_path = kwargs.get('image_path', None) + self.package_name = kwargs.get('package_name', None) + self.package_family_name = kwargs.get('package_family_name', None) + self.display_name = kwargs.get('display_name', None) + self.package_relative_path = kwargs.get('package_relative_path', None) + self.is_regular_registration = kwargs.get('is_regular_registration', None) + self.is_active = kwargs.get('is_active', None) + self.package_dependencies = kwargs.get('package_dependencies', None) + self.version = kwargs.get('version', None) + self.last_updated = kwargs.get('last_updated', None) + self.package_applications = kwargs.get('package_applications', None) + + +class MsixPackageApplications(msrest.serialization.Model): + """Schema for MSIX Package Application properties. + + :param app_id: Package Application Id, found in appxmanifest.xml. + :type app_id: str + :param description: Description of Package Application. + :type description: str + :param app_user_model_id: Used to activate Package Application. Consists of Package Name and + ApplicationID. Found in appxmanifest.xml. + :type app_user_model_id: str + :param friendly_name: User friendly name. + :type friendly_name: str + :param icon_image_name: User friendly name. + :type icon_image_name: str + :param raw_icon: the icon a 64 bit string as a byte array. + :type raw_icon: bytearray + :param raw_png: the icon a 64 bit string as a byte array. + :type raw_png: bytearray + """ + + _attribute_map = { + 'app_id': {'key': 'appId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'app_user_model_id': {'key': 'appUserModelID', 'type': 'str'}, + 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + 'icon_image_name': {'key': 'iconImageName', 'type': 'str'}, + 'raw_icon': {'key': 'rawIcon', 'type': 'bytearray'}, + 'raw_png': {'key': 'rawPng', 'type': 'bytearray'}, + } + + def __init__( + self, + **kwargs + ): + super(MsixPackageApplications, self).__init__(**kwargs) + self.app_id = kwargs.get('app_id', None) + self.description = kwargs.get('description', None) + self.app_user_model_id = kwargs.get('app_user_model_id', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.icon_image_name = kwargs.get('icon_image_name', None) + self.raw_icon = kwargs.get('raw_icon', None) + self.raw_png = kwargs.get('raw_png', None) + + +class MsixPackageDependencies(msrest.serialization.Model): + """Schema for MSIX Package Dependencies properties. + + :param dependency_name: Name of package dependency. + :type dependency_name: str + :param publisher: Name of dependency publisher. + :type publisher: str + :param min_version: Dependency version required. + :type min_version: str + """ + + _attribute_map = { + 'dependency_name': {'key': 'dependencyName', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'min_version': {'key': 'minVersion', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MsixPackageDependencies, self).__init__(**kwargs) + self.dependency_name = kwargs.get('dependency_name', None) + self.publisher = kwargs.get('publisher', None) + self.min_version = kwargs.get('min_version', None) + + +class MSIXPackageList(msrest.serialization.Model): + """List of MSIX Package definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of MSIX Package definitions. + :type value: list[~desktop_virtualization_api_client.models.MSIXPackage] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MSIXPackage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MSIXPackageList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class MSIXPackagePatch(Resource): + """MSIX Package properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param is_active: Set a version of the package to be active across hostpool. + :type is_active: bool + :param is_regular_registration: Set Registration mode. Regular or Delayed. + :type is_regular_registration: bool + :param display_name: Display name for MSIX Package. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, + 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MSIXPackagePatch, self).__init__(**kwargs) + self.is_active = kwargs.get('is_active', None) + self.is_regular_registration = kwargs.get('is_regular_registration', None) + self.display_name = kwargs.get('display_name', None) + + +class OperationProperties(msrest.serialization.Model): + """Properties of the operation. + + :param service_specification: Service specification payload. + :type service_specification: ~desktop_virtualization_api_client.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = kwargs.get('service_specification', None) + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :type name: str + :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. + :type publisher: str + :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product + maps to the OfferID specified for the artifact at the time of Data Market onboarding. + :type product: str + :param promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :type promotion_code: str + :param version: The version of the desired product/artifact. + :type version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = kwargs['name'] + self.publisher = kwargs['publisher'] + self.product = kwargs['product'] + self.promotion_code = kwargs.get('promotion_code', None) + self.version = kwargs.get('version', None) + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState + :param provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :type provisioning_state: str or + ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = kwargs.get('private_endpoint', None) + self.private_link_service_connection_state = kwargs.get('private_link_service_connection_state', None) + self.provisioning_state = kwargs.get('provisioning_state', None) + + +class PrivateEndpointConnectionListResultWithSystemData(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Array of private endpoint connections. + :type value: + list[~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionWithSystemData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionListResultWithSystemData, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState + :param provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :type provisioning_state: str or + ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpointConnectionWithSystemData, self).__init__(**kwargs) + self.system_data = None + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = kwargs.get('required_zone_names', None) + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Array of private link resources. + :type value: list[~desktop_virtualization_api_client.models.PrivateLinkResource] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or + ~desktop_virtualization_api_client.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = kwargs.get('status', None) + self.description = kwargs.get('description', None) + self.actions_required = kwargs.get('actions_required', None) + + +class RegistrationInfo(msrest.serialization.Model): + """Represents a RegistrationInfo definition. + + :param expiration_time: Expiration time of registration token. + :type expiration_time: ~datetime.datetime + :param token: The registration token base64 encoded string. + :type token: str + :param registration_token_operation: The type of resetting the token. Possible values include: + "Delete", "None", "Update". + :type registration_token_operation: str or + ~desktop_virtualization_api_client.models.RegistrationTokenOperation + """ + + _attribute_map = { + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'token': {'key': 'token', 'type': 'str'}, + 'registration_token_operation': {'key': 'registrationTokenOperation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistrationInfo, self).__init__(**kwargs) + self.expiration_time = kwargs.get('expiration_time', None) + self.token = kwargs.get('token', None) + self.registration_token_operation = kwargs.get('registration_token_operation', None) + + +class RegistrationInfoPatch(msrest.serialization.Model): + """Represents a RegistrationInfo definition. + + :param expiration_time: Expiration time of registration token. + :type expiration_time: ~datetime.datetime + :param registration_token_operation: The type of resetting the token. Possible values include: + "Delete", "None", "Update". + :type registration_token_operation: str or + ~desktop_virtualization_api_client.models.RegistrationTokenOperation + """ + + _attribute_map = { + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'registration_token_operation': {'key': 'registrationTokenOperation', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(RegistrationInfoPatch, self).__init__(**kwargs) + self.expiration_time = kwargs.get('expiration_time', None) + self.registration_token_operation = kwargs.get('registration_token_operation', None) + + +class ResourceModelWithAllowedPropertySetIdentity(Identity): + """ResourceModelWithAllowedPropertySetIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type type: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceModelWithAllowedPropertySetIdentity, self).__init__(**kwargs) + + +class ResourceModelWithAllowedPropertySetPlan(Plan): + """ResourceModelWithAllowedPropertySetPlan. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :type name: str + :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. + :type publisher: str + :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product + maps to the OfferID specified for the artifact at the time of Data Market onboarding. + :type product: str + :param promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :type promotion_code: str + :param version: The version of the desired product/artifact. + :type version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceModelWithAllowedPropertySetPlan, self).__init__(**kwargs) + + +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~desktop_virtualization_api_client.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + self.tier = kwargs.get('tier', None) + self.size = kwargs.get('size', None) + self.family = kwargs.get('family', None) + self.capacity = kwargs.get('capacity', None) + + +class ResourceModelWithAllowedPropertySetSku(Sku): + """ResourceModelWithAllowedPropertySetSku. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~desktop_virtualization_api_client.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceModelWithAllowedPropertySetSku, self).__init__(**kwargs) + + +class ResourceProviderOperation(msrest.serialization.Model): + """Supported operation of this resource provider. + + :param name: Operation name, in format of {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~desktop_virtualization_api_client.models.ResourceProviderOperationDisplay + :param is_data_action: Is a data action. + :type is_data_action: bool + :param properties: Properties of the operation. + :type properties: ~desktop_virtualization_api_client.models.OperationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', None) + self.is_data_action = kwargs.get('is_data_action', None) + self.properties = kwargs.get('properties', None) + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Desktop Virtualization. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of this operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = kwargs.get('provider', None) + self.resource = kwargs.get('resource', None) + self.operation = kwargs.get('operation', None) + self.description = kwargs.get('description', None) + + +class ResourceProviderOperationList(msrest.serialization.Model): + """Result of the request to list operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of operations supported by this resource provider. + :type value: list[~desktop_virtualization_api_client.models.ResourceProviderOperation] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ScalingHostPoolReference(msrest.serialization.Model): + """Scaling plan reference to hostpool. + + :param host_pool_arm_path: Arm path of referenced hostpool. + :type host_pool_arm_path: str + :param scaling_plan_enabled: Is the scaling plan enabled for this hostpool. + :type scaling_plan_enabled: bool + """ + + _attribute_map = { + 'host_pool_arm_path': {'key': 'hostPoolArmPath', 'type': 'str'}, + 'scaling_plan_enabled': {'key': 'scalingPlanEnabled', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ScalingHostPoolReference, self).__init__(**kwargs) + self.host_pool_arm_path = kwargs.get('host_pool_arm_path', None) + self.scaling_plan_enabled = kwargs.get('scaling_plan_enabled', None) + + +class ScalingPlan(ResourceModelWithAllowedPropertySet): + """Represents a scaling plan definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of scaling plan. (internal use). + :vartype object_id: str + :param description: Description of scaling plan. + :type description: str + :param friendly_name: User friendly name of scaling plan. + :type friendly_name: str + :param time_zone: Timezone of the scaling plan. + :type time_zone: str + :param host_pool_type: HostPool type for desktop. Possible values include: "Pooled". + :type host_pool_type: str or ~desktop_virtualization_api_client.models.ScalingHostPoolType + :param exclusion_tag: Exclusion tag for scaling plan. + :type exclusion_tag: str + :param schedules: List of ScalingSchedule definitions. + :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] + :param host_pool_references: List of ScalingHostPoolReference definitions. + :type host_pool_references: + list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, + 'host_pool_type': {'key': 'properties.hostPoolType', 'type': 'str'}, + 'exclusion_tag': {'key': 'properties.exclusionTag', 'type': 'str'}, + 'schedules': {'key': 'properties.schedules', 'type': '[ScalingSchedule]'}, + 'host_pool_references': {'key': 'properties.hostPoolReferences', 'type': '[ScalingHostPoolReference]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScalingPlan, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.time_zone = kwargs.get('time_zone', None) + self.host_pool_type = kwargs.get('host_pool_type', None) + self.exclusion_tag = kwargs.get('exclusion_tag', None) + self.schedules = kwargs.get('schedules', None) + self.host_pool_references = kwargs.get('host_pool_references', None) + + +class ScalingPlanList(msrest.serialization.Model): + """List of scaling plan definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of scaling plan definitions. + :type value: list[~desktop_virtualization_api_client.models.ScalingPlan] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScalingPlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScalingPlanList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class ScalingPlanPatch(msrest.serialization.Model): + """Scaling plan properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of scaling plan. + :type description: str + :param friendly_name: User friendly name of scaling plan. + :type friendly_name: str + :param time_zone: Timezone of the scaling plan. + :type time_zone: str + :param exclusion_tag: Exclusion tag for scaling plan. + :type exclusion_tag: str + :param schedules: List of ScalingSchedule definitions. + :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] + :param host_pool_references: List of ScalingHostPoolReference definitions. + :type host_pool_references: + list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, + 'exclusion_tag': {'key': 'properties.exclusionTag', 'type': 'str'}, + 'schedules': {'key': 'properties.schedules', 'type': '[ScalingSchedule]'}, + 'host_pool_references': {'key': 'properties.hostPoolReferences', 'type': '[ScalingHostPoolReference]'}, + } + + def __init__( + self, + **kwargs + ): + super(ScalingPlanPatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.time_zone = kwargs.get('time_zone', None) + self.exclusion_tag = kwargs.get('exclusion_tag', None) + self.schedules = kwargs.get('schedules', None) + self.host_pool_references = kwargs.get('host_pool_references', None) + + +class ScalingSchedule(msrest.serialization.Model): + """Scaling plan schedule. + + :param name: Name of the scaling schedule. + :type name: str + :param days_of_week: Set of days of the week on which this schedule is active. + :type days_of_week: list[str or + ~desktop_virtualization_api_client.models.ScalingScheduleDaysOfWeekItem] + :param ramp_up_start_time: Starting time for ramp up period. + :type ramp_up_start_time: ~desktop_virtualization_api_client.models.Time + :param ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Possible + values include: "BreadthFirst", "DepthFirst". + :type ramp_up_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + :param ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. + :type ramp_up_minimum_hosts_pct: int + :param ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. + :type ramp_up_capacity_threshold_pct: int + :param peak_start_time: Starting time for peak period. + :type peak_start_time: ~desktop_virtualization_api_client.models.Time + :param peak_load_balancing_algorithm: Load balancing algorithm for peak period. Possible values + include: "BreadthFirst", "DepthFirst". + :type peak_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + :param ramp_down_start_time: Starting time for ramp down period. + :type ramp_down_start_time: ~desktop_virtualization_api_client.models.Time + :param ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. + Possible values include: "BreadthFirst", "DepthFirst". + :type ramp_down_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + :param ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. + :type ramp_down_minimum_hosts_pct: int + :param ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. + :type ramp_down_capacity_threshold_pct: int + :param ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. + :type ramp_down_force_logoff_users: bool + :param ramp_down_stop_hosts_when: Specifies when to stop hosts during ramp down period. + Possible values include: "ZeroSessions", "ZeroActiveSessions". + :type ramp_down_stop_hosts_when: str or ~desktop_virtualization_api_client.models.StopHostsWhen + :param ramp_down_wait_time_minutes: Number of minutes to wait to stop hosts during ramp down + period. + :type ramp_down_wait_time_minutes: int + :param ramp_down_notification_message: Notification message for users during ramp down period. + :type ramp_down_notification_message: str + :param off_peak_start_time: Starting time for off-peak period. + :type off_peak_start_time: ~desktop_virtualization_api_client.models.Time + :param off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. + Possible values include: "BreadthFirst", "DepthFirst". + :type off_peak_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + """ + + _validation = { + 'ramp_up_minimum_hosts_pct': {'maximum': 100, 'minimum': 0}, + 'ramp_up_capacity_threshold_pct': {'maximum': 100, 'minimum': 1}, + 'ramp_down_minimum_hosts_pct': {'maximum': 100, 'minimum': 0}, + 'ramp_down_capacity_threshold_pct': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'days_of_week': {'key': 'daysOfWeek', 'type': '[str]'}, + 'ramp_up_start_time': {'key': 'rampUpStartTime', 'type': 'Time'}, + 'ramp_up_load_balancing_algorithm': {'key': 'rampUpLoadBalancingAlgorithm', 'type': 'str'}, + 'ramp_up_minimum_hosts_pct': {'key': 'rampUpMinimumHostsPct', 'type': 'int'}, + 'ramp_up_capacity_threshold_pct': {'key': 'rampUpCapacityThresholdPct', 'type': 'int'}, + 'peak_start_time': {'key': 'peakStartTime', 'type': 'Time'}, + 'peak_load_balancing_algorithm': {'key': 'peakLoadBalancingAlgorithm', 'type': 'str'}, + 'ramp_down_start_time': {'key': 'rampDownStartTime', 'type': 'Time'}, + 'ramp_down_load_balancing_algorithm': {'key': 'rampDownLoadBalancingAlgorithm', 'type': 'str'}, + 'ramp_down_minimum_hosts_pct': {'key': 'rampDownMinimumHostsPct', 'type': 'int'}, + 'ramp_down_capacity_threshold_pct': {'key': 'rampDownCapacityThresholdPct', 'type': 'int'}, + 'ramp_down_force_logoff_users': {'key': 'rampDownForceLogoffUsers', 'type': 'bool'}, + 'ramp_down_stop_hosts_when': {'key': 'rampDownStopHostsWhen', 'type': 'str'}, + 'ramp_down_wait_time_minutes': {'key': 'rampDownWaitTimeMinutes', 'type': 'int'}, + 'ramp_down_notification_message': {'key': 'rampDownNotificationMessage', 'type': 'str'}, + 'off_peak_start_time': {'key': 'offPeakStartTime', 'type': 'Time'}, + 'off_peak_load_balancing_algorithm': {'key': 'offPeakLoadBalancingAlgorithm', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ScalingSchedule, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.days_of_week = kwargs.get('days_of_week', None) + self.ramp_up_start_time = kwargs.get('ramp_up_start_time', None) + self.ramp_up_load_balancing_algorithm = kwargs.get('ramp_up_load_balancing_algorithm', None) + self.ramp_up_minimum_hosts_pct = kwargs.get('ramp_up_minimum_hosts_pct', None) + self.ramp_up_capacity_threshold_pct = kwargs.get('ramp_up_capacity_threshold_pct', None) + self.peak_start_time = kwargs.get('peak_start_time', None) + self.peak_load_balancing_algorithm = kwargs.get('peak_load_balancing_algorithm', None) + self.ramp_down_start_time = kwargs.get('ramp_down_start_time', None) + self.ramp_down_load_balancing_algorithm = kwargs.get('ramp_down_load_balancing_algorithm', None) + self.ramp_down_minimum_hosts_pct = kwargs.get('ramp_down_minimum_hosts_pct', None) + self.ramp_down_capacity_threshold_pct = kwargs.get('ramp_down_capacity_threshold_pct', None) + self.ramp_down_force_logoff_users = kwargs.get('ramp_down_force_logoff_users', None) + self.ramp_down_stop_hosts_when = kwargs.get('ramp_down_stop_hosts_when', None) + self.ramp_down_wait_time_minutes = kwargs.get('ramp_down_wait_time_minutes', None) + self.ramp_down_notification_message = kwargs.get('ramp_down_notification_message', None) + self.off_peak_start_time = kwargs.get('off_peak_start_time', None) + self.off_peak_load_balancing_algorithm = kwargs.get('off_peak_load_balancing_algorithm', None) + + +class SendMessage(msrest.serialization.Model): + """Represents message sent to a UserSession. + + :param message_title: Title of message. + :type message_title: str + :param message_body: Body of message. + :type message_body: str + """ + + _attribute_map = { + 'message_title': {'key': 'messageTitle', 'type': 'str'}, + 'message_body': {'key': 'messageBody', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SendMessage, self).__init__(**kwargs) + self.message_title = kwargs.get('message_title', None) + self.message_body = kwargs.get('message_body', None) + + +class ServiceSpecification(msrest.serialization.Model): + """Service specification payload. + + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~desktop_virtualization_api_client.models.LogSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = kwargs.get('log_specifications', None) + + +class SessionHost(Resource): + """Represents a SessionHost definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of SessionHost. (internal use). + :vartype object_id: str + :param last_heart_beat: Last heart beat from SessionHost. + :type last_heart_beat: ~datetime.datetime + :param sessions: Number of sessions on SessionHost. + :type sessions: int + :param agent_version: Version of agent on SessionHost. + :type agent_version: str + :param allow_new_session: Allow a new session. + :type allow_new_session: bool + :ivar virtual_machine_id: Virtual Machine Id of SessionHost's underlying virtual machine. + :vartype virtual_machine_id: str + :ivar resource_id: Resource Id of SessionHost's underlying virtual machine. + :vartype resource_id: str + :param assigned_user: User assigned to SessionHost. + :type assigned_user: str + :param status: Status for a SessionHost. Possible values include: "Available", "Unavailable", + "Shutdown", "Disconnected", "Upgrading", "UpgradeFailed", "NoHeartbeat", "NotJoinedToDomain", + "DomainTrustRelationshipLost", "SxSStackListenerNotReady", "FSLogixNotHealthy", + "NeedsAssistance". + :type status: str or ~desktop_virtualization_api_client.models.Status + :ivar status_timestamp: The timestamp of the status. + :vartype status_timestamp: ~datetime.datetime + :param os_version: The version of the OS on the session host. + :type os_version: str + :param sx_s_stack_version: The version of the side by side stack on the session host. + :type sx_s_stack_version: str + :param update_state: Update state of a SessionHost. Possible values include: "Initial", + "Pending", "Started", "Succeeded", "Failed". + :type update_state: str or ~desktop_virtualization_api_client.models.UpdateState + :ivar last_update_time: The timestamp of the last update. + :vartype last_update_time: ~datetime.datetime + :param update_error_message: The error message. + :type update_error_message: str + :ivar session_host_health_check_results: List of SessionHostHealthCheckReports. + :vartype session_host_health_check_results: + list[~desktop_virtualization_api_client.models.SessionHostHealthCheckReport] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'virtual_machine_id': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'status_timestamp': {'readonly': True}, + 'last_update_time': {'readonly': True}, + 'session_host_health_check_results': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'iso-8601'}, + 'sessions': {'key': 'properties.sessions', 'type': 'int'}, + 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, + 'allow_new_session': {'key': 'properties.allowNewSession', 'type': 'bool'}, + 'virtual_machine_id': {'key': 'properties.virtualMachineId', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_timestamp': {'key': 'properties.statusTimestamp', 'type': 'iso-8601'}, + 'os_version': {'key': 'properties.osVersion', 'type': 'str'}, + 'sx_s_stack_version': {'key': 'properties.sxSStackVersion', 'type': 'str'}, + 'update_state': {'key': 'properties.updateState', 'type': 'str'}, + 'last_update_time': {'key': 'properties.lastUpdateTime', 'type': 'iso-8601'}, + 'update_error_message': {'key': 'properties.updateErrorMessage', 'type': 'str'}, + 'session_host_health_check_results': {'key': 'properties.sessionHostHealthCheckResults', 'type': '[SessionHostHealthCheckReport]'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHost, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.last_heart_beat = kwargs.get('last_heart_beat', None) + self.sessions = kwargs.get('sessions', None) + self.agent_version = kwargs.get('agent_version', None) + self.allow_new_session = kwargs.get('allow_new_session', None) + self.virtual_machine_id = None + self.resource_id = None + self.assigned_user = kwargs.get('assigned_user', None) + self.status = kwargs.get('status', None) + self.status_timestamp = None + self.os_version = kwargs.get('os_version', None) + self.sx_s_stack_version = kwargs.get('sx_s_stack_version', None) + self.update_state = kwargs.get('update_state', None) + self.last_update_time = None + self.update_error_message = kwargs.get('update_error_message', None) + self.session_host_health_check_results = None + + +class SessionHostHealthCheckFailureDetails(msrest.serialization.Model): + """Contains details on the failure. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: Failure message: hints on what is wrong and how to recover. + :vartype message: str + :ivar error_code: Error code corresponding for the failure. + :vartype error_code: int + :ivar last_health_check_date_time: The timestamp of the last update. + :vartype last_health_check_date_time: ~datetime.datetime + """ + + _validation = { + 'message': {'readonly': True}, + 'error_code': {'readonly': True}, + 'last_health_check_date_time': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'int'}, + 'last_health_check_date_time': {'key': 'lastHealthCheckDateTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHostHealthCheckFailureDetails, self).__init__(**kwargs) + self.message = None + self.error_code = None + self.last_health_check_date_time = None + + +class SessionHostHealthCheckReport(msrest.serialization.Model): + """The report for session host information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar health_check_name: Represents the name of the health check operation performed. Possible + values include: "DomainJoinedCheck", "DomainTrustCheck", "FSLogixHealthCheck", + "SxSStackListenerCheck", "UrlsAccessibleCheck", "MonitoringAgentCheck", "DomainReachable", + "WebRTCRedirectorCheck", "SupportedEncryptionCheck", "MetaDataServiceCheck", + "AppAttachHealthCheck". + :vartype health_check_name: str or ~desktop_virtualization_api_client.models.HealthCheckName + :ivar health_check_result: Represents the Health state of the health check we performed. + Possible values include: "Unknown", "HealthCheckSucceeded", "HealthCheckFailed", + "SessionHostShutdown". + :vartype health_check_result: str or + ~desktop_virtualization_api_client.models.HealthCheckResult + :ivar additional_failure_details: Additional detailed information on the failure. + :vartype additional_failure_details: + ~desktop_virtualization_api_client.models.SessionHostHealthCheckFailureDetails + """ + + _validation = { + 'health_check_name': {'readonly': True}, + 'health_check_result': {'readonly': True}, + 'additional_failure_details': {'readonly': True}, + } + + _attribute_map = { + 'health_check_name': {'key': 'healthCheckName', 'type': 'str'}, + 'health_check_result': {'key': 'healthCheckResult', 'type': 'str'}, + 'additional_failure_details': {'key': 'additionalFailureDetails', 'type': 'SessionHostHealthCheckFailureDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHostHealthCheckReport, self).__init__(**kwargs) + self.health_check_name = None + self.health_check_result = None + self.additional_failure_details = None + + +class SessionHostList(msrest.serialization.Model): + """List of SessionHost definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of SessionHost definitions. + :type value: list[~desktop_virtualization_api_client.models.SessionHost] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SessionHost]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHostList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class SessionHostPatch(Resource): + """SessionHost properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param allow_new_session: Allow a new session. + :type allow_new_session: bool + :param assigned_user: User assigned to SessionHost. + :type assigned_user: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'allow_new_session': {'key': 'properties.allowNewSession', 'type': 'bool'}, + 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHostPatch, self).__init__(**kwargs) + self.allow_new_session = kwargs.get('allow_new_session', None) + self.assigned_user = kwargs.get('assigned_user', None) + + +class StartMenuItem(Resource): + """Represents a StartMenuItem definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param app_alias: Alias of StartMenuItem. + :type app_alias: str + :param file_path: Path to the file of StartMenuItem. + :type file_path: str + :param command_line_arguments: Command line arguments for StartMenuItem. + :type command_line_arguments: str + :param icon_path: Path to the icon. + :type icon_path: str + :param icon_index: Index of the icon. + :type icon_index: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'app_alias': {'key': 'properties.appAlias', 'type': 'str'}, + 'file_path': {'key': 'properties.filePath', 'type': 'str'}, + 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, + 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, + 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(StartMenuItem, self).__init__(**kwargs) + self.app_alias = kwargs.get('app_alias', None) + self.file_path = kwargs.get('file_path', None) + self.command_line_arguments = kwargs.get('command_line_arguments', None) + self.icon_path = kwargs.get('icon_path', None) + self.icon_index = kwargs.get('icon_index', None) + + +class StartMenuItemList(msrest.serialization.Model): + """List of StartMenuItem definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of StartMenuItem definitions. + :type value: list[~desktop_virtualization_api_client.models.StartMenuItem] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StartMenuItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(StartMenuItemList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = kwargs.get('created_by', None) + self.created_by_type = kwargs.get('created_by_type', None) + self.created_at = kwargs.get('created_at', None) + self.last_modified_by = kwargs.get('last_modified_by', None) + self.last_modified_by_type = kwargs.get('last_modified_by_type', None) + self.last_modified_at = kwargs.get('last_modified_at', None) + + +class Time(msrest.serialization.Model): + """The time for a scaling action to occur. + + All required parameters must be populated in order to send to Azure. + + :param hour: Required. The hour. + :type hour: int + :param minute: Required. The minute. + :type minute: int + """ + + _validation = { + 'hour': {'required': True, 'maximum': 23, 'minimum': 0}, + 'minute': {'required': True, 'maximum': 59, 'minimum': 0}, + } + + _attribute_map = { + 'hour': {'key': 'hour', 'type': 'int'}, + 'minute': {'key': 'minute', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(Time, self).__init__(**kwargs) + self.hour = kwargs['hour'] + self.minute = kwargs['minute'] + + +class UserSession(Resource): + """Represents a UserSession definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of user session. (internal use). + :vartype object_id: str + :param user_principal_name: The user principal name. + :type user_principal_name: str + :param application_type: Application type of application. Possible values include: "RemoteApp", + "Desktop". + :type application_type: str or ~desktop_virtualization_api_client.models.ApplicationType + :param session_state: State of user session. Possible values include: "Unknown", "Active", + "Disconnected", "Pending", "LogOff", "UserProfileDiskMounted". + :type session_state: str or ~desktop_virtualization_api_client.models.SessionState + :param active_directory_user_name: The active directory user name. + :type active_directory_user_name: str + :param create_time: The timestamp of the user session create. + :type create_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.userPrincipalName', 'type': 'str'}, + 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, + 'session_state': {'key': 'properties.sessionState', 'type': 'str'}, + 'active_directory_user_name': {'key': 'properties.activeDirectoryUserName', 'type': 'str'}, + 'create_time': {'key': 'properties.createTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSession, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.user_principal_name = kwargs.get('user_principal_name', None) + self.application_type = kwargs.get('application_type', None) + self.session_state = kwargs.get('session_state', None) + self.active_directory_user_name = kwargs.get('active_directory_user_name', None) + self.create_time = kwargs.get('create_time', None) + + +class UserSessionList(msrest.serialization.Model): + """List of UserSession definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of UserSession definitions. + :type value: list[~desktop_virtualization_api_client.models.UserSession] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSession]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(UserSessionList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class Workspace(ResourceModelWithAllowedPropertySet): + """Represents a Workspace definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of Workspace. (internal use). + :vartype object_id: str + :param description: Description of Workspace. + :type description: str + :param friendly_name: Friendly name of Workspace. + :type friendly_name: str + :param application_group_references: List of applicationGroup resource Ids. + :type application_group_references: list[str] + :ivar cloud_pc_resource: Is cloud pc resource. + :vartype cloud_pc_resource: bool + :param public_network_access: Enabled allows this resource to be accessed from both public and + private networks, Disabled allows this resource to only be accessed via private endpoints. + Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'cloud_pc_resource': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Workspace, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.application_group_references = kwargs.get('application_group_references', None) + self.cloud_pc_resource = None + self.public_network_access = kwargs.get('public_network_access', None) + + +class WorkspaceList(msrest.serialization.Model): + """List of Workspace definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Workspace definitions. + :type value: list[~desktop_virtualization_api_client.models.Workspace] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Workspace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkspaceList, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = None + + +class WorkspacePatch(msrest.serialization.Model): + """Workspace properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of Workspace. + :type description: str + :param friendly_name: Friendly name of Workspace. + :type friendly_name: str + :param application_group_references: List of applicationGroup links. + :type application_group_references: list[str] + :param public_network_access: Enabled to allow this resource to be access from the public + network. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(WorkspacePatch, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.application_group_references = kwargs.get('application_group_references', None) + self.public_network_access = kwargs.get('public_network_access', None) diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py new file mode 100644 index 000000000000..9af6a672aa43 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/models/_models_py3.py @@ -0,0 +1,3469 @@ +# 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 datetime +from typing import Dict, List, Optional, Union + +import msrest.serialization + +from ._desktop_virtualization_api_client_enums import * + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + + +class Application(Resource): + """Schema for Application properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of Application. (internal use). + :vartype object_id: str + :param description: Description of Application. + :type description: str + :param friendly_name: Friendly name of Application. + :type friendly_name: str + :param file_path: Specifies a path for the executable file for the application. + :type file_path: str + :param msix_package_family_name: Specifies the package family name for MSIX applications. + :type msix_package_family_name: str + :param msix_package_application_id: Specifies the package application Id for MSIX applications. + :type msix_package_application_id: str + :param application_type: Resource Type of Application. Possible values include: "InBuilt", + "MsixApplication". + :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType + :param command_line_setting: Required. Specifies whether this published application can be + launched with command line arguments provided by the client, command line arguments specified + at publish time, or no command line arguments at all. Possible values include: "DoNotAllow", + "Allow", "Require". + :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting + :param command_line_arguments: Command Line Arguments for Application. + :type command_line_arguments: str + :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + server. + :type show_in_portal: bool + :param icon_path: Path to icon. + :type icon_path: str + :param icon_index: Index of the icon. + :type icon_index: int + :ivar icon_hash: Hash of the icon. + :vartype icon_hash: str + :ivar icon_content: the icon a 64 bit string as a byte array. + :vartype icon_content: bytearray + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'command_line_setting': {'required': True}, + 'icon_hash': {'readonly': True}, + 'icon_content': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'file_path': {'key': 'properties.filePath', 'type': 'str'}, + 'msix_package_family_name': {'key': 'properties.msixPackageFamilyName', 'type': 'str'}, + 'msix_package_application_id': {'key': 'properties.msixPackageApplicationId', 'type': 'str'}, + 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, + 'command_line_setting': {'key': 'properties.commandLineSetting', 'type': 'str'}, + 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, + 'show_in_portal': {'key': 'properties.showInPortal', 'type': 'bool'}, + 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, + 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, + 'icon_hash': {'key': 'properties.iconHash', 'type': 'str'}, + 'icon_content': {'key': 'properties.iconContent', 'type': 'bytearray'}, + } + + def __init__( + self, + *, + command_line_setting: Union[str, "CommandLineSetting"], + description: Optional[str] = None, + friendly_name: Optional[str] = None, + file_path: Optional[str] = None, + msix_package_family_name: Optional[str] = None, + msix_package_application_id: Optional[str] = None, + application_type: Optional[Union[str, "RemoteApplicationType"]] = None, + command_line_arguments: Optional[str] = None, + show_in_portal: Optional[bool] = None, + icon_path: Optional[str] = None, + icon_index: Optional[int] = None, + **kwargs + ): + super(Application, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.description = description + self.friendly_name = friendly_name + self.file_path = file_path + self.msix_package_family_name = msix_package_family_name + self.msix_package_application_id = msix_package_application_id + self.application_type = application_type + self.command_line_setting = command_line_setting + self.command_line_arguments = command_line_arguments + self.show_in_portal = show_in_portal + self.icon_path = icon_path + self.icon_index = icon_index + self.icon_hash = None + self.icon_content = None + + +class ResourceModelWithAllowedPropertySet(msrest.serialization.Model): + """The resource model definition containing the full set of allowed properties for a resource. Except properties bag, there cannot be a top level property outside of this set. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + managed_by: Optional[str] = None, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ResourceModelWithAllowedPropertySetIdentity"] = None, + sku: Optional["ResourceModelWithAllowedPropertySetSku"] = None, + plan: Optional["ResourceModelWithAllowedPropertySetPlan"] = None, + **kwargs + ): + super(ResourceModelWithAllowedPropertySet, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.managed_by = managed_by + self.kind = kind + self.etag = None + self.tags = tags + self.identity = identity + self.sku = sku + self.plan = plan + + +class ApplicationGroup(ResourceModelWithAllowedPropertySet): + """Represents a ApplicationGroup definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of ApplicationGroup. (internal use). + :vartype object_id: str + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_name: str + :param host_pool_arm_path: Required. HostPool arm path of ApplicationGroup. + :type host_pool_arm_path: str + :ivar workspace_arm_path: Workspace arm path of ApplicationGroup. + :vartype workspace_arm_path: str + :param application_group_type: Required. Resource Type of ApplicationGroup. Possible values + include: "RemoteApp", "Desktop". + :type application_group_type: str or + ~desktop_virtualization_api_client.models.ApplicationGroupType + :param migration_request: The registration info of HostPool. + :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties + :ivar cloud_pc_resource: Is cloud pc resource. + :vartype cloud_pc_resource: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'host_pool_arm_path': {'required': True}, + 'workspace_arm_path': {'readonly': True}, + 'application_group_type': {'required': True}, + 'cloud_pc_resource': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'host_pool_arm_path': {'key': 'properties.hostPoolArmPath', 'type': 'str'}, + 'workspace_arm_path': {'key': 'properties.workspaceArmPath', 'type': 'str'}, + 'application_group_type': {'key': 'properties.applicationGroupType', 'type': 'str'}, + 'migration_request': {'key': 'properties.migrationRequest', 'type': 'MigrationRequestProperties'}, + 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, + } + + def __init__( + self, + *, + host_pool_arm_path: str, + application_group_type: Union[str, "ApplicationGroupType"], + location: Optional[str] = None, + managed_by: Optional[str] = None, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ResourceModelWithAllowedPropertySetIdentity"] = None, + sku: Optional["ResourceModelWithAllowedPropertySetSku"] = None, + plan: Optional["ResourceModelWithAllowedPropertySetPlan"] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + migration_request: Optional["MigrationRequestProperties"] = None, + **kwargs + ): + super(ApplicationGroup, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) + self.system_data = None + self.object_id = None + self.description = description + self.friendly_name = friendly_name + self.host_pool_arm_path = host_pool_arm_path + self.workspace_arm_path = None + self.application_group_type = application_group_type + self.migration_request = migration_request + self.cloud_pc_resource = None + + +class ApplicationGroupList(msrest.serialization.Model): + """List of ApplicationGroup definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of ApplicationGroup definitions. + :type value: list[~desktop_virtualization_api_client.models.ApplicationGroup] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationGroup]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApplicationGroup"]] = None, + **kwargs + ): + super(ApplicationGroupList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ApplicationGroupPatch(Resource): + """ApplicationGroup properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ): + super(ApplicationGroupPatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.friendly_name = friendly_name + + +class ApplicationList(msrest.serialization.Model): + """List of Application definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Application definitions. + :type value: list[~desktop_virtualization_api_client.models.Application] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Application]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Application"]] = None, + **kwargs + ): + super(ApplicationList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ApplicationPatch(msrest.serialization.Model): + """Application properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of Application. + :type description: str + :param friendly_name: Friendly name of Application. + :type friendly_name: str + :param file_path: Specifies a path for the executable file for the application. + :type file_path: str + :param command_line_setting: Specifies whether this published application can be launched with + command line arguments provided by the client, command line arguments specified at publish + time, or no command line arguments at all. Possible values include: "DoNotAllow", "Allow", + "Require". + :type command_line_setting: str or ~desktop_virtualization_api_client.models.CommandLineSetting + :param command_line_arguments: Command Line Arguments for Application. + :type command_line_arguments: str + :param show_in_portal: Specifies whether to show the RemoteApp program in the RD Web Access + server. + :type show_in_portal: bool + :param icon_path: Path to icon. + :type icon_path: str + :param icon_index: Index of the icon. + :type icon_index: int + :param msix_package_family_name: Specifies the package family name for MSIX applications. + :type msix_package_family_name: str + :param msix_package_application_id: Specifies the package application Id for MSIX applications. + :type msix_package_application_id: str + :param application_type: Resource Type of Application. Possible values include: "InBuilt", + "MsixApplication". + :type application_type: str or ~desktop_virtualization_api_client.models.RemoteApplicationType + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'file_path': {'key': 'properties.filePath', 'type': 'str'}, + 'command_line_setting': {'key': 'properties.commandLineSetting', 'type': 'str'}, + 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, + 'show_in_portal': {'key': 'properties.showInPortal', 'type': 'bool'}, + 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, + 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, + 'msix_package_family_name': {'key': 'properties.msixPackageFamilyName', 'type': 'str'}, + 'msix_package_application_id': {'key': 'properties.msixPackageApplicationId', 'type': 'str'}, + 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + file_path: Optional[str] = None, + command_line_setting: Optional[Union[str, "CommandLineSetting"]] = None, + command_line_arguments: Optional[str] = None, + show_in_portal: Optional[bool] = None, + icon_path: Optional[str] = None, + icon_index: Optional[int] = None, + msix_package_family_name: Optional[str] = None, + msix_package_application_id: Optional[str] = None, + application_type: Optional[Union[str, "RemoteApplicationType"]] = None, + **kwargs + ): + super(ApplicationPatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.friendly_name = friendly_name + self.file_path = file_path + self.command_line_setting = command_line_setting + self.command_line_arguments = command_line_arguments + self.show_in_portal = show_in_portal + self.icon_path = icon_path + self.icon_index = icon_index + self.msix_package_family_name = msix_package_family_name + self.msix_package_application_id = msix_package_application_id + self.application_type = application_type + + +class CloudErrorProperties(msrest.serialization.Model): + """Cloud error object properties. + + :param code: Error code. + :type code: str + :param message: Error message indicating why the operation failed. + :type message: str + """ + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(CloudErrorProperties, self).__init__(**kwargs) + self.code = code + self.message = message + + +class Desktop(Resource): + """Schema for Desktop properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of Desktop. (internal use). + :vartype object_id: str + :param description: Description of Desktop. + :type description: str + :param friendly_name: Friendly name of Desktop. + :type friendly_name: str + :ivar icon_hash: Hash of the icon. + :vartype icon_hash: str + :ivar icon_content: The icon a 64 bit string as a byte array. + :vartype icon_content: bytearray + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'icon_hash': {'readonly': True}, + 'icon_content': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'icon_hash': {'key': 'properties.iconHash', 'type': 'str'}, + 'icon_content': {'key': 'properties.iconContent', 'type': 'bytearray'}, + } + + def __init__( + self, + *, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ): + super(Desktop, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.description = description + self.friendly_name = friendly_name + self.icon_hash = None + self.icon_content = None + + +class DesktopList(msrest.serialization.Model): + """List of Desktop definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Desktop definitions. + :type value: list[~desktop_virtualization_api_client.models.Desktop] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Desktop]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Desktop"]] = None, + **kwargs + ): + super(DesktopList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DesktopPatch(msrest.serialization.Model): + """Desktop properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of Desktop. + :type description: str + :param friendly_name: Friendly name of Desktop. + :type friendly_name: str + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ): + super(DesktopPatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.friendly_name = friendly_name + + +class ExpandMsixImage(Resource): + """Represents the definition of contents retrieved after expanding the MSIX Image. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param package_alias: Alias of MSIX Package. + :type package_alias: str + :param image_path: VHD/CIM image path on Network Share. + :type image_path: str + :param package_name: Package Name from appxmanifest.xml. + :type package_name: str + :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :type package_family_name: str + :param package_full_name: Package Full Name from appxmanifest.xml. + :type package_full_name: str + :param display_name: User friendly Name to be displayed in the portal. + :type display_name: str + :param package_relative_path: Relative Path to the package inside the image. + :type package_relative_path: str + :param is_regular_registration: Specifies how to register Package in feed. + :type is_regular_registration: bool + :param is_active: Make this version of the package the active one across the hostpool. + :type is_active: bool + :param package_dependencies: List of package dependencies. + :type package_dependencies: + list[~desktop_virtualization_api_client.models.MsixPackageDependencies] + :param version: Package Version found in the appxmanifest.xml. + :type version: str + :param last_updated: Date Package was last updated, found in the appxmanifest.xml. + :type last_updated: ~datetime.datetime + :param package_applications: List of package applications. + :type package_applications: + list[~desktop_virtualization_api_client.models.MsixPackageApplications] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'package_alias': {'key': 'properties.packageAlias', 'type': 'str'}, + 'image_path': {'key': 'properties.imagePath', 'type': 'str'}, + 'package_name': {'key': 'properties.packageName', 'type': 'str'}, + 'package_family_name': {'key': 'properties.packageFamilyName', 'type': 'str'}, + 'package_full_name': {'key': 'properties.packageFullName', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'package_relative_path': {'key': 'properties.packageRelativePath', 'type': 'str'}, + 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, + 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, + 'package_dependencies': {'key': 'properties.packageDependencies', 'type': '[MsixPackageDependencies]'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'last_updated': {'key': 'properties.lastUpdated', 'type': 'iso-8601'}, + 'package_applications': {'key': 'properties.packageApplications', 'type': '[MsixPackageApplications]'}, + } + + def __init__( + self, + *, + package_alias: Optional[str] = None, + image_path: Optional[str] = None, + package_name: Optional[str] = None, + package_family_name: Optional[str] = None, + package_full_name: Optional[str] = None, + display_name: Optional[str] = None, + package_relative_path: Optional[str] = None, + is_regular_registration: Optional[bool] = None, + is_active: Optional[bool] = None, + package_dependencies: Optional[List["MsixPackageDependencies"]] = None, + version: Optional[str] = None, + last_updated: Optional[datetime.datetime] = None, + package_applications: Optional[List["MsixPackageApplications"]] = None, + **kwargs + ): + super(ExpandMsixImage, self).__init__(**kwargs) + self.package_alias = package_alias + self.image_path = image_path + self.package_name = package_name + self.package_family_name = package_family_name + self.package_full_name = package_full_name + self.display_name = display_name + self.package_relative_path = package_relative_path + self.is_regular_registration = is_regular_registration + self.is_active = is_active + self.package_dependencies = package_dependencies + self.version = version + self.last_updated = last_updated + self.package_applications = package_applications + + +class ExpandMsixImageList(msrest.serialization.Model): + """List of MSIX package properties retrieved from MSIX Image expansion. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of MSIX package properties from give MSIX Image. + :type value: list[~desktop_virtualization_api_client.models.ExpandMsixImage] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ExpandMsixImage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ExpandMsixImage"]] = None, + **kwargs + ): + super(ExpandMsixImageList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class HostPool(ResourceModelWithAllowedPropertySet): + """Represents a HostPool definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of HostPool. (internal use). + :vartype object_id: str + :param friendly_name: Friendly name of HostPool. + :type friendly_name: str + :param description: Description of HostPool. + :type description: str + :param host_pool_type: Required. HostPool type for desktop. Possible values include: + "Personal", "Pooled", "BYODesktop". + :type host_pool_type: str or ~desktop_virtualization_api_client.models.HostPoolType + :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible + values include: "Automatic", "Direct". + :type personal_desktop_assignment_type: str or + ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType + :param custom_rdp_property: Custom rdp property of HostPool. + :type custom_rdp_property: str + :param max_session_limit: The max session limit of HostPool. + :type max_session_limit: int + :param load_balancer_type: Required. The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType + :param ring: The ring number of HostPool. + :type ring: int + :param validation_environment: Is validation environment. + :type validation_environment: bool + :param registration_info: The registration info of HostPool. + :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfo + :param vm_template: VM template for sessionhosts configuration within hostpool. + :type vm_template: str + :ivar application_group_references: List of applicationGroup links. + :vartype application_group_references: list[str] + :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :type ssoadfs_authority: str + :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + certificates. + :type sso_client_id: str + :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + communication to ADFS. + :type sso_client_secret_key_vault_path: str + :param sso_secret_type: The type of single sign on Secret Type. Possible values include: + "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". + :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType + :param preferred_app_group_type: Required. The type of preferred application group type, + default to Desktop Application Group. Possible values include: "None", "Desktop", + "RailApplications". + :type preferred_app_group_type: str or + ~desktop_virtualization_api_client.models.PreferredAppGroupType + :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :type start_vm_on_connect: bool + :param migration_request: The registration info of HostPool. + :type migration_request: ~desktop_virtualization_api_client.models.MigrationRequestProperties + :ivar cloud_pc_resource: Is cloud pc resource. + :vartype cloud_pc_resource: bool + :param public_network_access: Enabled allows this resource to be accessed from both public and + private networks, Disabled allows this resource to only be accessed via private endpoints. + Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'host_pool_type': {'required': True}, + 'load_balancer_type': {'required': True}, + 'application_group_references': {'readonly': True}, + 'preferred_app_group_type': {'required': True}, + 'cloud_pc_resource': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'host_pool_type': {'key': 'properties.hostPoolType', 'type': 'str'}, + 'personal_desktop_assignment_type': {'key': 'properties.personalDesktopAssignmentType', 'type': 'str'}, + 'custom_rdp_property': {'key': 'properties.customRdpProperty', 'type': 'str'}, + 'max_session_limit': {'key': 'properties.maxSessionLimit', 'type': 'int'}, + 'load_balancer_type': {'key': 'properties.loadBalancerType', 'type': 'str'}, + 'ring': {'key': 'properties.ring', 'type': 'int'}, + 'validation_environment': {'key': 'properties.validationEnvironment', 'type': 'bool'}, + 'registration_info': {'key': 'properties.registrationInfo', 'type': 'RegistrationInfo'}, + 'vm_template': {'key': 'properties.vmTemplate', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + 'ssoadfs_authority': {'key': 'properties.ssoadfsAuthority', 'type': 'str'}, + 'sso_client_id': {'key': 'properties.ssoClientId', 'type': 'str'}, + 'sso_client_secret_key_vault_path': {'key': 'properties.ssoClientSecretKeyVaultPath', 'type': 'str'}, + 'sso_secret_type': {'key': 'properties.ssoSecretType', 'type': 'str'}, + 'preferred_app_group_type': {'key': 'properties.preferredAppGroupType', 'type': 'str'}, + 'start_vm_on_connect': {'key': 'properties.startVMOnConnect', 'type': 'bool'}, + 'migration_request': {'key': 'properties.migrationRequest', 'type': 'MigrationRequestProperties'}, + 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + host_pool_type: Union[str, "HostPoolType"], + load_balancer_type: Union[str, "LoadBalancerType"], + preferred_app_group_type: Union[str, "PreferredAppGroupType"], + location: Optional[str] = None, + managed_by: Optional[str] = None, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ResourceModelWithAllowedPropertySetIdentity"] = None, + sku: Optional["ResourceModelWithAllowedPropertySetSku"] = None, + plan: Optional["ResourceModelWithAllowedPropertySetPlan"] = None, + friendly_name: Optional[str] = None, + description: Optional[str] = None, + personal_desktop_assignment_type: Optional[Union[str, "PersonalDesktopAssignmentType"]] = None, + custom_rdp_property: Optional[str] = None, + max_session_limit: Optional[int] = None, + ring: Optional[int] = None, + validation_environment: Optional[bool] = None, + registration_info: Optional["RegistrationInfo"] = None, + vm_template: Optional[str] = None, + ssoadfs_authority: Optional[str] = None, + sso_client_id: Optional[str] = None, + sso_client_secret_key_vault_path: Optional[str] = None, + sso_secret_type: Optional[Union[str, "SSOSecretType"]] = None, + start_vm_on_connect: Optional[bool] = None, + migration_request: Optional["MigrationRequestProperties"] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + **kwargs + ): + super(HostPool, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) + self.system_data = None + self.object_id = None + self.friendly_name = friendly_name + self.description = description + self.host_pool_type = host_pool_type + self.personal_desktop_assignment_type = personal_desktop_assignment_type + self.custom_rdp_property = custom_rdp_property + self.max_session_limit = max_session_limit + self.load_balancer_type = load_balancer_type + self.ring = ring + self.validation_environment = validation_environment + self.registration_info = registration_info + self.vm_template = vm_template + self.application_group_references = None + self.ssoadfs_authority = ssoadfs_authority + self.sso_client_id = sso_client_id + self.sso_client_secret_key_vault_path = sso_client_secret_key_vault_path + self.sso_secret_type = sso_secret_type + self.preferred_app_group_type = preferred_app_group_type + self.start_vm_on_connect = start_vm_on_connect + self.migration_request = migration_request + self.cloud_pc_resource = None + self.public_network_access = public_network_access + + +class HostPoolList(msrest.serialization.Model): + """List of HostPool definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of HostPool definitions. + :type value: list[~desktop_virtualization_api_client.models.HostPool] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[HostPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["HostPool"]] = None, + **kwargs + ): + super(HostPoolList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class HostPoolPatch(Resource): + """HostPool properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param friendly_name: Friendly name of HostPool. + :type friendly_name: str + :param description: Description of HostPool. + :type description: str + :param custom_rdp_property: Custom rdp property of HostPool. + :type custom_rdp_property: str + :param max_session_limit: The max session limit of HostPool. + :type max_session_limit: int + :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. Possible + values include: "Automatic", "Direct". + :type personal_desktop_assignment_type: str or + ~desktop_virtualization_api_client.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :type load_balancer_type: str or ~desktop_virtualization_api_client.models.LoadBalancerType + :param ring: The ring number of HostPool. + :type ring: int + :param validation_environment: Is validation environment. + :type validation_environment: bool + :param registration_info: The registration info of HostPool. + :type registration_info: ~desktop_virtualization_api_client.models.RegistrationInfoPatch + :param vm_template: VM template for sessionhosts configuration within hostpool. + :type vm_template: str + :param ssoadfs_authority: URL to customer ADFS server for signing WVD SSO certificates. + :type ssoadfs_authority: str + :param sso_client_id: ClientId for the registered Relying Party used to issue WVD SSO + certificates. + :type sso_client_id: str + :param sso_client_secret_key_vault_path: Path to Azure KeyVault storing the secret used for + communication to ADFS. + :type sso_client_secret_key_vault_path: str + :param sso_secret_type: The type of single sign on Secret Type. Possible values include: + "SharedKey", "Certificate", "SharedKeyInKeyVault", "CertificateInKeyVault". + :type sso_secret_type: str or ~desktop_virtualization_api_client.models.SSOSecretType + :param preferred_app_group_type: The type of preferred application group type, default to + Desktop Application Group. Possible values include: "None", "Desktop", "RailApplications". + :type preferred_app_group_type: str or + ~desktop_virtualization_api_client.models.PreferredAppGroupType + :param start_vm_on_connect: The flag to turn on/off StartVMOnConnect feature. + :type start_vm_on_connect: bool + :param public_network_access: Enabled to allow this resource to be access from the public + network. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'custom_rdp_property': {'key': 'properties.customRdpProperty', 'type': 'str'}, + 'max_session_limit': {'key': 'properties.maxSessionLimit', 'type': 'int'}, + 'personal_desktop_assignment_type': {'key': 'properties.personalDesktopAssignmentType', 'type': 'str'}, + 'load_balancer_type': {'key': 'properties.loadBalancerType', 'type': 'str'}, + 'ring': {'key': 'properties.ring', 'type': 'int'}, + 'validation_environment': {'key': 'properties.validationEnvironment', 'type': 'bool'}, + 'registration_info': {'key': 'properties.registrationInfo', 'type': 'RegistrationInfoPatch'}, + 'vm_template': {'key': 'properties.vmTemplate', 'type': 'str'}, + 'ssoadfs_authority': {'key': 'properties.ssoadfsAuthority', 'type': 'str'}, + 'sso_client_id': {'key': 'properties.ssoClientId', 'type': 'str'}, + 'sso_client_secret_key_vault_path': {'key': 'properties.ssoClientSecretKeyVaultPath', 'type': 'str'}, + 'sso_secret_type': {'key': 'properties.ssoSecretType', 'type': 'str'}, + 'preferred_app_group_type': {'key': 'properties.preferredAppGroupType', 'type': 'str'}, + 'start_vm_on_connect': {'key': 'properties.startVMOnConnect', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + friendly_name: Optional[str] = None, + description: Optional[str] = None, + custom_rdp_property: Optional[str] = None, + max_session_limit: Optional[int] = None, + personal_desktop_assignment_type: Optional[Union[str, "PersonalDesktopAssignmentType"]] = None, + load_balancer_type: Optional[Union[str, "LoadBalancerType"]] = None, + ring: Optional[int] = None, + validation_environment: Optional[bool] = None, + registration_info: Optional["RegistrationInfoPatch"] = None, + vm_template: Optional[str] = None, + ssoadfs_authority: Optional[str] = None, + sso_client_id: Optional[str] = None, + sso_client_secret_key_vault_path: Optional[str] = None, + sso_secret_type: Optional[Union[str, "SSOSecretType"]] = None, + preferred_app_group_type: Optional[Union[str, "PreferredAppGroupType"]] = None, + start_vm_on_connect: Optional[bool] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + **kwargs + ): + super(HostPoolPatch, self).__init__(**kwargs) + self.tags = tags + self.friendly_name = friendly_name + self.description = description + self.custom_rdp_property = custom_rdp_property + self.max_session_limit = max_session_limit + self.personal_desktop_assignment_type = personal_desktop_assignment_type + self.load_balancer_type = load_balancer_type + self.ring = ring + self.validation_environment = validation_environment + self.registration_info = registration_info + self.vm_template = vm_template + self.ssoadfs_authority = ssoadfs_authority + self.sso_client_id = sso_client_id + self.sso_client_secret_key_vault_path = sso_client_secret_key_vault_path + self.sso_secret_type = sso_secret_type + self.preferred_app_group_type = preferred_app_group_type + self.start_vm_on_connect = start_vm_on_connect + self.public_network_access = public_network_access + + +class Identity(msrest.serialization.Model): + """Identity for the resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type type: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + **kwargs + ): + super(Identity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + + +class LogSpecification(msrest.serialization.Model): + """Specifications of the Log for Azure Monitoring. + + :param name: Name of the log. + :type name: str + :param display_name: Localized friendly display name of the log. + :type display_name: str + :param blob_duration: Blob duration of the log. + :type blob_duration: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display_name': {'key': 'displayName', 'type': 'str'}, + 'blob_duration': {'key': 'blobDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + **kwargs + ): + super(LogSpecification, self).__init__(**kwargs) + self.name = name + self.display_name = display_name + self.blob_duration = blob_duration + + +class MigrationRequestProperties(msrest.serialization.Model): + """Properties for arm migration. + + :param operation: The type of operation for migration. Possible values include: "Start", + "Revoke", "Complete", "Hide", "Unhide". + :type operation: str or ~desktop_virtualization_api_client.models.Operation + :param migration_path: The path to the legacy object to migrate. + :type migration_path: str + """ + + _attribute_map = { + 'operation': {'key': 'operation', 'type': 'str'}, + 'migration_path': {'key': 'migrationPath', 'type': 'str'}, + } + + def __init__( + self, + *, + operation: Optional[Union[str, "Operation"]] = None, + migration_path: Optional[str] = None, + **kwargs + ): + super(MigrationRequestProperties, self).__init__(**kwargs) + self.operation = operation + self.migration_path = migration_path + + +class MSIXImageURI(msrest.serialization.Model): + """Represents URI referring to MSIX Image. + + :param uri: URI to Image. + :type uri: str + """ + + _attribute_map = { + 'uri': {'key': 'uri', 'type': 'str'}, + } + + def __init__( + self, + *, + uri: Optional[str] = None, + **kwargs + ): + super(MSIXImageURI, self).__init__(**kwargs) + self.uri = uri + + +class MSIXPackage(Resource): + """Schema for MSIX Package properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :param image_path: VHD/CIM image path on Network Share. + :type image_path: str + :param package_name: Package Name from appxmanifest.xml. + :type package_name: str + :param package_family_name: Package Family Name from appxmanifest.xml. Contains Package Name + and Publisher name. + :type package_family_name: str + :param display_name: User friendly Name to be displayed in the portal. + :type display_name: str + :param package_relative_path: Relative Path to the package inside the image. + :type package_relative_path: str + :param is_regular_registration: Specifies how to register Package in feed. + :type is_regular_registration: bool + :param is_active: Make this version of the package the active one across the hostpool. + :type is_active: bool + :param package_dependencies: List of package dependencies. + :type package_dependencies: + list[~desktop_virtualization_api_client.models.MsixPackageDependencies] + :param version: Package Version found in the appxmanifest.xml. + :type version: str + :param last_updated: Date Package was last updated, found in the appxmanifest.xml. + :type last_updated: ~datetime.datetime + :param package_applications: List of package applications. + :type package_applications: + list[~desktop_virtualization_api_client.models.MsixPackageApplications] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'image_path': {'key': 'properties.imagePath', 'type': 'str'}, + 'package_name': {'key': 'properties.packageName', 'type': 'str'}, + 'package_family_name': {'key': 'properties.packageFamilyName', 'type': 'str'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + 'package_relative_path': {'key': 'properties.packageRelativePath', 'type': 'str'}, + 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, + 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, + 'package_dependencies': {'key': 'properties.packageDependencies', 'type': '[MsixPackageDependencies]'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'last_updated': {'key': 'properties.lastUpdated', 'type': 'iso-8601'}, + 'package_applications': {'key': 'properties.packageApplications', 'type': '[MsixPackageApplications]'}, + } + + def __init__( + self, + *, + image_path: Optional[str] = None, + package_name: Optional[str] = None, + package_family_name: Optional[str] = None, + display_name: Optional[str] = None, + package_relative_path: Optional[str] = None, + is_regular_registration: Optional[bool] = None, + is_active: Optional[bool] = None, + package_dependencies: Optional[List["MsixPackageDependencies"]] = None, + version: Optional[str] = None, + last_updated: Optional[datetime.datetime] = None, + package_applications: Optional[List["MsixPackageApplications"]] = None, + **kwargs + ): + super(MSIXPackage, self).__init__(**kwargs) + self.system_data = None + self.image_path = image_path + self.package_name = package_name + self.package_family_name = package_family_name + self.display_name = display_name + self.package_relative_path = package_relative_path + self.is_regular_registration = is_regular_registration + self.is_active = is_active + self.package_dependencies = package_dependencies + self.version = version + self.last_updated = last_updated + self.package_applications = package_applications + + +class MsixPackageApplications(msrest.serialization.Model): + """Schema for MSIX Package Application properties. + + :param app_id: Package Application Id, found in appxmanifest.xml. + :type app_id: str + :param description: Description of Package Application. + :type description: str + :param app_user_model_id: Used to activate Package Application. Consists of Package Name and + ApplicationID. Found in appxmanifest.xml. + :type app_user_model_id: str + :param friendly_name: User friendly name. + :type friendly_name: str + :param icon_image_name: User friendly name. + :type icon_image_name: str + :param raw_icon: the icon a 64 bit string as a byte array. + :type raw_icon: bytearray + :param raw_png: the icon a 64 bit string as a byte array. + :type raw_png: bytearray + """ + + _attribute_map = { + 'app_id': {'key': 'appId', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'app_user_model_id': {'key': 'appUserModelID', 'type': 'str'}, + 'friendly_name': {'key': 'friendlyName', 'type': 'str'}, + 'icon_image_name': {'key': 'iconImageName', 'type': 'str'}, + 'raw_icon': {'key': 'rawIcon', 'type': 'bytearray'}, + 'raw_png': {'key': 'rawPng', 'type': 'bytearray'}, + } + + def __init__( + self, + *, + app_id: Optional[str] = None, + description: Optional[str] = None, + app_user_model_id: Optional[str] = None, + friendly_name: Optional[str] = None, + icon_image_name: Optional[str] = None, + raw_icon: Optional[bytearray] = None, + raw_png: Optional[bytearray] = None, + **kwargs + ): + super(MsixPackageApplications, self).__init__(**kwargs) + self.app_id = app_id + self.description = description + self.app_user_model_id = app_user_model_id + self.friendly_name = friendly_name + self.icon_image_name = icon_image_name + self.raw_icon = raw_icon + self.raw_png = raw_png + + +class MsixPackageDependencies(msrest.serialization.Model): + """Schema for MSIX Package Dependencies properties. + + :param dependency_name: Name of package dependency. + :type dependency_name: str + :param publisher: Name of dependency publisher. + :type publisher: str + :param min_version: Dependency version required. + :type min_version: str + """ + + _attribute_map = { + 'dependency_name': {'key': 'dependencyName', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'min_version': {'key': 'minVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + dependency_name: Optional[str] = None, + publisher: Optional[str] = None, + min_version: Optional[str] = None, + **kwargs + ): + super(MsixPackageDependencies, self).__init__(**kwargs) + self.dependency_name = dependency_name + self.publisher = publisher + self.min_version = min_version + + +class MSIXPackageList(msrest.serialization.Model): + """List of MSIX Package definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of MSIX Package definitions. + :type value: list[~desktop_virtualization_api_client.models.MSIXPackage] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[MSIXPackage]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["MSIXPackage"]] = None, + **kwargs + ): + super(MSIXPackageList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class MSIXPackagePatch(Resource): + """MSIX Package properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param is_active: Set a version of the package to be active across hostpool. + :type is_active: bool + :param is_regular_registration: Set Registration mode. Regular or Delayed. + :type is_regular_registration: bool + :param display_name: Display name for MSIX Package. + :type display_name: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'is_active': {'key': 'properties.isActive', 'type': 'bool'}, + 'is_regular_registration': {'key': 'properties.isRegularRegistration', 'type': 'bool'}, + 'display_name': {'key': 'properties.displayName', 'type': 'str'}, + } + + def __init__( + self, + *, + is_active: Optional[bool] = None, + is_regular_registration: Optional[bool] = None, + display_name: Optional[str] = None, + **kwargs + ): + super(MSIXPackagePatch, self).__init__(**kwargs) + self.is_active = is_active + self.is_regular_registration = is_regular_registration + self.display_name = display_name + + +class OperationProperties(msrest.serialization.Model): + """Properties of the operation. + + :param service_specification: Service specification payload. + :type service_specification: ~desktop_virtualization_api_client.models.ServiceSpecification + """ + + _attribute_map = { + 'service_specification': {'key': 'serviceSpecification', 'type': 'ServiceSpecification'}, + } + + def __init__( + self, + *, + service_specification: Optional["ServiceSpecification"] = None, + **kwargs + ): + super(OperationProperties, self).__init__(**kwargs) + self.service_specification = service_specification + + +class Plan(msrest.serialization.Model): + """Plan for the resource. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :type name: str + :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. + :type publisher: str + :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product + maps to the OfferID specified for the artifact at the time of Data Market onboarding. + :type product: str + :param promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :type promotion_code: str + :param version: The version of the desired product/artifact. + :type version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(Plan, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.product = product + self.promotion_code = promotion_code + self.version = version + + +class PrivateEndpoint(msrest.serialization.Model): + """The Private Endpoint resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: The ARM identifier for Private Endpoint. + :vartype id: str + """ + + _validation = { + 'id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PrivateEndpoint, self).__init__(**kwargs) + self.id = None + + +class PrivateEndpointConnection(Resource): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState + :param provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :type provisioning_state: str or + ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + super(PrivateEndpointConnection, self).__init__(**kwargs) + self.private_endpoint = private_endpoint + self.private_link_service_connection_state = private_link_service_connection_state + self.provisioning_state = provisioning_state + + +class PrivateEndpointConnectionListResultWithSystemData(msrest.serialization.Model): + """List of private endpoint connection associated with the specified storage account. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Array of private endpoint connections. + :type value: + list[~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateEndpointConnectionWithSystemData]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateEndpointConnectionWithSystemData"]] = None, + **kwargs + ): + super(PrivateEndpointConnectionListResultWithSystemData, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateEndpointConnectionWithSystemData(PrivateEndpointConnection): + """The Private Endpoint Connection resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param private_endpoint: The resource of private end point. + :type private_endpoint: ~desktop_virtualization_api_client.models.PrivateEndpoint + :param private_link_service_connection_state: A collection of information about the state of + the connection between service consumer and provider. + :type private_link_service_connection_state: + ~desktop_virtualization_api_client.models.PrivateLinkServiceConnectionState + :param provisioning_state: The provisioning state of the private endpoint connection resource. + Possible values include: "Succeeded", "Creating", "Deleting", "Failed". + :type provisioning_state: str or + ~desktop_virtualization_api_client.models.PrivateEndpointConnectionProvisioningState + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpoint'}, + 'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionState'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + private_endpoint: Optional["PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["PrivateLinkServiceConnectionState"] = None, + provisioning_state: Optional[Union[str, "PrivateEndpointConnectionProvisioningState"]] = None, + **kwargs + ): + super(PrivateEndpointConnectionWithSystemData, self).__init__(private_endpoint=private_endpoint, private_link_service_connection_state=private_link_service_connection_state, provisioning_state=provisioning_state, **kwargs) + self.system_data = None + + +class PrivateLinkResource(Resource): + """A private link resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar group_id: The private link resource group id. + :vartype group_id: str + :ivar required_members: The private link resource required member names. + :vartype required_members: list[str] + :param required_zone_names: The private link resource Private link DNS zone name. + :type required_zone_names: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'group_id': {'readonly': True}, + 'required_members': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'group_id': {'key': 'properties.groupId', 'type': 'str'}, + 'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'}, + 'required_zone_names': {'key': 'properties.requiredZoneNames', 'type': '[str]'}, + } + + def __init__( + self, + *, + required_zone_names: Optional[List[str]] = None, + **kwargs + ): + super(PrivateLinkResource, self).__init__(**kwargs) + self.group_id = None + self.required_members = None + self.required_zone_names = required_zone_names + + +class PrivateLinkResourceListResult(msrest.serialization.Model): + """A list of private link resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: Array of private link resources. + :type value: list[~desktop_virtualization_api_client.models.PrivateLinkResource] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[PrivateLinkResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["PrivateLinkResource"]] = None, + **kwargs + ): + super(PrivateLinkResourceListResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class PrivateLinkServiceConnectionState(msrest.serialization.Model): + """A collection of information about the state of the connection between service consumer and provider. + + :param status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Possible values include: "Pending", "Approved", "Rejected". + :type status: str or + ~desktop_virtualization_api_client.models.PrivateEndpointServiceConnectionStatus + :param description: The reason for approval/rejection of the connection. + :type description: str + :param actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :type actions_required: str + """ + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'actions_required': {'key': 'actionsRequired', 'type': 'str'}, + } + + def __init__( + self, + *, + status: Optional[Union[str, "PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + **kwargs + ): + super(PrivateLinkServiceConnectionState, self).__init__(**kwargs) + self.status = status + self.description = description + self.actions_required = actions_required + + +class RegistrationInfo(msrest.serialization.Model): + """Represents a RegistrationInfo definition. + + :param expiration_time: Expiration time of registration token. + :type expiration_time: ~datetime.datetime + :param token: The registration token base64 encoded string. + :type token: str + :param registration_token_operation: The type of resetting the token. Possible values include: + "Delete", "None", "Update". + :type registration_token_operation: str or + ~desktop_virtualization_api_client.models.RegistrationTokenOperation + """ + + _attribute_map = { + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'token': {'key': 'token', 'type': 'str'}, + 'registration_token_operation': {'key': 'registrationTokenOperation', 'type': 'str'}, + } + + def __init__( + self, + *, + expiration_time: Optional[datetime.datetime] = None, + token: Optional[str] = None, + registration_token_operation: Optional[Union[str, "RegistrationTokenOperation"]] = None, + **kwargs + ): + super(RegistrationInfo, self).__init__(**kwargs) + self.expiration_time = expiration_time + self.token = token + self.registration_token_operation = registration_token_operation + + +class RegistrationInfoPatch(msrest.serialization.Model): + """Represents a RegistrationInfo definition. + + :param expiration_time: Expiration time of registration token. + :type expiration_time: ~datetime.datetime + :param registration_token_operation: The type of resetting the token. Possible values include: + "Delete", "None", "Update". + :type registration_token_operation: str or + ~desktop_virtualization_api_client.models.RegistrationTokenOperation + """ + + _attribute_map = { + 'expiration_time': {'key': 'expirationTime', 'type': 'iso-8601'}, + 'registration_token_operation': {'key': 'registrationTokenOperation', 'type': 'str'}, + } + + def __init__( + self, + *, + expiration_time: Optional[datetime.datetime] = None, + registration_token_operation: Optional[Union[str, "RegistrationTokenOperation"]] = None, + **kwargs + ): + super(RegistrationInfoPatch, self).__init__(**kwargs) + self.expiration_time = expiration_time + self.registration_token_operation = registration_token_operation + + +class ResourceModelWithAllowedPropertySetIdentity(Identity): + """ResourceModelWithAllowedPropertySetIdentity. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of resource identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. + :vartype tenant_id: str + :param type: The identity type. The only acceptable values to pass in are None and + "SystemAssigned". The default value is None. + :type type: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + **kwargs + ): + super(ResourceModelWithAllowedPropertySetIdentity, self).__init__(type=type, **kwargs) + + +class ResourceModelWithAllowedPropertySetPlan(Plan): + """ResourceModelWithAllowedPropertySetPlan. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. A user defined name of the 3rd Party Artifact that is being procured. + :type name: str + :param publisher: Required. The publisher of the 3rd Party Artifact that is being bought. E.g. + NewRelic. + :type publisher: str + :param product: Required. The 3rd Party artifact that is being procured. E.g. NewRelic. Product + maps to the OfferID specified for the artifact at the time of Data Market onboarding. + :type product: str + :param promotion_code: A publisher provided promotion code as provisioned in Data Market for + the said product/artifact. + :type promotion_code: str + :param version: The version of the desired product/artifact. + :type version: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'product': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'publisher', 'type': 'str'}, + 'product': {'key': 'product', 'type': 'str'}, + 'promotion_code': {'key': 'promotionCode', 'type': 'str'}, + 'version': {'key': 'version', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + product: str, + promotion_code: Optional[str] = None, + version: Optional[str] = None, + **kwargs + ): + super(ResourceModelWithAllowedPropertySetPlan, self).__init__(name=name, publisher=publisher, product=product, promotion_code=promotion_code, version=version, **kwargs) + + +class Sku(msrest.serialization.Model): + """The resource model definition representing SKU. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~desktop_virtualization_api_client.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[Union[str, "SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(Sku, self).__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 Azure. + + :param name: Required. The name of the SKU. Ex - P3. It is typically a letter+number code. + :type name: str + :param tier: This field is required to be implemented by the Resource Provider if the service + has more than one tier, but is not required on a PUT. Possible values include: "Free", "Basic", + "Standard", "Premium". + :type tier: str or ~desktop_virtualization_api_client.models.SkuTier + :param size: The SKU size. When the name field is the combination of tier and some other value, + this would be the standalone code. + :type size: str + :param family: If the service has different generations of hardware, for the same SKU, then + that can be captured here. + :type family: str + :param capacity: If the SKU supports scale out/in then the capacity integer should be included. + If scale out/in is not possible for the resource this may be omitted. + :type capacity: int + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'size': {'key': 'size', 'type': 'str'}, + 'family': {'key': 'family', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + name: str, + tier: Optional[Union[str, "SkuTier"]] = None, + size: Optional[str] = None, + family: Optional[str] = None, + capacity: Optional[int] = None, + **kwargs + ): + super(ResourceModelWithAllowedPropertySetSku, self).__init__(name=name, tier=tier, size=size, family=family, capacity=capacity, **kwargs) + + +class ResourceProviderOperation(msrest.serialization.Model): + """Supported operation of this resource provider. + + :param name: Operation name, in format of {provider}/{resource}/{operation}. + :type name: str + :param display: Display metadata associated with the operation. + :type display: ~desktop_virtualization_api_client.models.ResourceProviderOperationDisplay + :param is_data_action: Is a data action. + :type is_data_action: bool + :param properties: Properties of the operation. + :type properties: ~desktop_virtualization_api_client.models.OperationProperties + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'properties': {'key': 'properties', 'type': 'OperationProperties'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["ResourceProviderOperationDisplay"] = None, + is_data_action: Optional[bool] = None, + properties: Optional["OperationProperties"] = None, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = name + self.display = display + self.is_data_action = is_data_action + self.properties = properties + + +class ResourceProviderOperationDisplay(msrest.serialization.Model): + """Display metadata associated with the operation. + + :param provider: Resource provider: Microsoft Desktop Virtualization. + :type provider: str + :param resource: Resource on which the operation is performed. + :type resource: str + :param operation: Type of operation: get, read, delete, etc. + :type operation: str + :param description: Description of this operation. + :type description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(ResourceProviderOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ResourceProviderOperationList(msrest.serialization.Model): + """Result of the request to list operations. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of operations supported by this resource provider. + :type value: list[~desktop_virtualization_api_client.models.ResourceProviderOperation] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceProviderOperation"]] = None, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ScalingHostPoolReference(msrest.serialization.Model): + """Scaling plan reference to hostpool. + + :param host_pool_arm_path: Arm path of referenced hostpool. + :type host_pool_arm_path: str + :param scaling_plan_enabled: Is the scaling plan enabled for this hostpool. + :type scaling_plan_enabled: bool + """ + + _attribute_map = { + 'host_pool_arm_path': {'key': 'hostPoolArmPath', 'type': 'str'}, + 'scaling_plan_enabled': {'key': 'scalingPlanEnabled', 'type': 'bool'}, + } + + def __init__( + self, + *, + host_pool_arm_path: Optional[str] = None, + scaling_plan_enabled: Optional[bool] = None, + **kwargs + ): + super(ScalingHostPoolReference, self).__init__(**kwargs) + self.host_pool_arm_path = host_pool_arm_path + self.scaling_plan_enabled = scaling_plan_enabled + + +class ScalingPlan(ResourceModelWithAllowedPropertySet): + """Represents a scaling plan definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of scaling plan. (internal use). + :vartype object_id: str + :param description: Description of scaling plan. + :type description: str + :param friendly_name: User friendly name of scaling plan. + :type friendly_name: str + :param time_zone: Timezone of the scaling plan. + :type time_zone: str + :param host_pool_type: HostPool type for desktop. Possible values include: "Pooled". + :type host_pool_type: str or ~desktop_virtualization_api_client.models.ScalingHostPoolType + :param exclusion_tag: Exclusion tag for scaling plan. + :type exclusion_tag: str + :param schedules: List of ScalingSchedule definitions. + :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] + :param host_pool_references: List of ScalingHostPoolReference definitions. + :type host_pool_references: + list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, + 'host_pool_type': {'key': 'properties.hostPoolType', 'type': 'str'}, + 'exclusion_tag': {'key': 'properties.exclusionTag', 'type': 'str'}, + 'schedules': {'key': 'properties.schedules', 'type': '[ScalingSchedule]'}, + 'host_pool_references': {'key': 'properties.hostPoolReferences', 'type': '[ScalingHostPoolReference]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + managed_by: Optional[str] = None, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ResourceModelWithAllowedPropertySetIdentity"] = None, + sku: Optional["ResourceModelWithAllowedPropertySetSku"] = None, + plan: Optional["ResourceModelWithAllowedPropertySetPlan"] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + time_zone: Optional[str] = None, + host_pool_type: Optional[Union[str, "ScalingHostPoolType"]] = None, + exclusion_tag: Optional[str] = None, + schedules: Optional[List["ScalingSchedule"]] = None, + host_pool_references: Optional[List["ScalingHostPoolReference"]] = None, + **kwargs + ): + super(ScalingPlan, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) + self.system_data = None + self.object_id = None + self.description = description + self.friendly_name = friendly_name + self.time_zone = time_zone + self.host_pool_type = host_pool_type + self.exclusion_tag = exclusion_tag + self.schedules = schedules + self.host_pool_references = host_pool_references + + +class ScalingPlanList(msrest.serialization.Model): + """List of scaling plan definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of scaling plan definitions. + :type value: list[~desktop_virtualization_api_client.models.ScalingPlan] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ScalingPlan]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ScalingPlan"]] = None, + **kwargs + ): + super(ScalingPlanList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ScalingPlanPatch(msrest.serialization.Model): + """Scaling plan properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of scaling plan. + :type description: str + :param friendly_name: User friendly name of scaling plan. + :type friendly_name: str + :param time_zone: Timezone of the scaling plan. + :type time_zone: str + :param exclusion_tag: Exclusion tag for scaling plan. + :type exclusion_tag: str + :param schedules: List of ScalingSchedule definitions. + :type schedules: list[~desktop_virtualization_api_client.models.ScalingSchedule] + :param host_pool_references: List of ScalingHostPoolReference definitions. + :type host_pool_references: + list[~desktop_virtualization_api_client.models.ScalingHostPoolReference] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'time_zone': {'key': 'properties.timeZone', 'type': 'str'}, + 'exclusion_tag': {'key': 'properties.exclusionTag', 'type': 'str'}, + 'schedules': {'key': 'properties.schedules', 'type': '[ScalingSchedule]'}, + 'host_pool_references': {'key': 'properties.hostPoolReferences', 'type': '[ScalingHostPoolReference]'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + time_zone: Optional[str] = None, + exclusion_tag: Optional[str] = None, + schedules: Optional[List["ScalingSchedule"]] = None, + host_pool_references: Optional[List["ScalingHostPoolReference"]] = None, + **kwargs + ): + super(ScalingPlanPatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.friendly_name = friendly_name + self.time_zone = time_zone + self.exclusion_tag = exclusion_tag + self.schedules = schedules + self.host_pool_references = host_pool_references + + +class ScalingSchedule(msrest.serialization.Model): + """Scaling plan schedule. + + :param name: Name of the scaling schedule. + :type name: str + :param days_of_week: Set of days of the week on which this schedule is active. + :type days_of_week: list[str or + ~desktop_virtualization_api_client.models.ScalingScheduleDaysOfWeekItem] + :param ramp_up_start_time: Starting time for ramp up period. + :type ramp_up_start_time: ~desktop_virtualization_api_client.models.Time + :param ramp_up_load_balancing_algorithm: Load balancing algorithm for ramp up period. Possible + values include: "BreadthFirst", "DepthFirst". + :type ramp_up_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + :param ramp_up_minimum_hosts_pct: Minimum host percentage for ramp up period. + :type ramp_up_minimum_hosts_pct: int + :param ramp_up_capacity_threshold_pct: Capacity threshold for ramp up period. + :type ramp_up_capacity_threshold_pct: int + :param peak_start_time: Starting time for peak period. + :type peak_start_time: ~desktop_virtualization_api_client.models.Time + :param peak_load_balancing_algorithm: Load balancing algorithm for peak period. Possible values + include: "BreadthFirst", "DepthFirst". + :type peak_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + :param ramp_down_start_time: Starting time for ramp down period. + :type ramp_down_start_time: ~desktop_virtualization_api_client.models.Time + :param ramp_down_load_balancing_algorithm: Load balancing algorithm for ramp down period. + Possible values include: "BreadthFirst", "DepthFirst". + :type ramp_down_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + :param ramp_down_minimum_hosts_pct: Minimum host percentage for ramp down period. + :type ramp_down_minimum_hosts_pct: int + :param ramp_down_capacity_threshold_pct: Capacity threshold for ramp down period. + :type ramp_down_capacity_threshold_pct: int + :param ramp_down_force_logoff_users: Should users be logged off forcefully from hosts. + :type ramp_down_force_logoff_users: bool + :param ramp_down_stop_hosts_when: Specifies when to stop hosts during ramp down period. + Possible values include: "ZeroSessions", "ZeroActiveSessions". + :type ramp_down_stop_hosts_when: str or ~desktop_virtualization_api_client.models.StopHostsWhen + :param ramp_down_wait_time_minutes: Number of minutes to wait to stop hosts during ramp down + period. + :type ramp_down_wait_time_minutes: int + :param ramp_down_notification_message: Notification message for users during ramp down period. + :type ramp_down_notification_message: str + :param off_peak_start_time: Starting time for off-peak period. + :type off_peak_start_time: ~desktop_virtualization_api_client.models.Time + :param off_peak_load_balancing_algorithm: Load balancing algorithm for off-peak period. + Possible values include: "BreadthFirst", "DepthFirst". + :type off_peak_load_balancing_algorithm: str or + ~desktop_virtualization_api_client.models.SessionHostLoadBalancingAlgorithm + """ + + _validation = { + 'ramp_up_minimum_hosts_pct': {'maximum': 100, 'minimum': 0}, + 'ramp_up_capacity_threshold_pct': {'maximum': 100, 'minimum': 1}, + 'ramp_down_minimum_hosts_pct': {'maximum': 100, 'minimum': 0}, + 'ramp_down_capacity_threshold_pct': {'maximum': 100, 'minimum': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'days_of_week': {'key': 'daysOfWeek', 'type': '[str]'}, + 'ramp_up_start_time': {'key': 'rampUpStartTime', 'type': 'Time'}, + 'ramp_up_load_balancing_algorithm': {'key': 'rampUpLoadBalancingAlgorithm', 'type': 'str'}, + 'ramp_up_minimum_hosts_pct': {'key': 'rampUpMinimumHostsPct', 'type': 'int'}, + 'ramp_up_capacity_threshold_pct': {'key': 'rampUpCapacityThresholdPct', 'type': 'int'}, + 'peak_start_time': {'key': 'peakStartTime', 'type': 'Time'}, + 'peak_load_balancing_algorithm': {'key': 'peakLoadBalancingAlgorithm', 'type': 'str'}, + 'ramp_down_start_time': {'key': 'rampDownStartTime', 'type': 'Time'}, + 'ramp_down_load_balancing_algorithm': {'key': 'rampDownLoadBalancingAlgorithm', 'type': 'str'}, + 'ramp_down_minimum_hosts_pct': {'key': 'rampDownMinimumHostsPct', 'type': 'int'}, + 'ramp_down_capacity_threshold_pct': {'key': 'rampDownCapacityThresholdPct', 'type': 'int'}, + 'ramp_down_force_logoff_users': {'key': 'rampDownForceLogoffUsers', 'type': 'bool'}, + 'ramp_down_stop_hosts_when': {'key': 'rampDownStopHostsWhen', 'type': 'str'}, + 'ramp_down_wait_time_minutes': {'key': 'rampDownWaitTimeMinutes', 'type': 'int'}, + 'ramp_down_notification_message': {'key': 'rampDownNotificationMessage', 'type': 'str'}, + 'off_peak_start_time': {'key': 'offPeakStartTime', 'type': 'Time'}, + 'off_peak_load_balancing_algorithm': {'key': 'offPeakLoadBalancingAlgorithm', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + days_of_week: Optional[List[Union[str, "ScalingScheduleDaysOfWeekItem"]]] = None, + ramp_up_start_time: Optional["Time"] = None, + ramp_up_load_balancing_algorithm: Optional[Union[str, "SessionHostLoadBalancingAlgorithm"]] = None, + ramp_up_minimum_hosts_pct: Optional[int] = None, + ramp_up_capacity_threshold_pct: Optional[int] = None, + peak_start_time: Optional["Time"] = None, + peak_load_balancing_algorithm: Optional[Union[str, "SessionHostLoadBalancingAlgorithm"]] = None, + ramp_down_start_time: Optional["Time"] = None, + ramp_down_load_balancing_algorithm: Optional[Union[str, "SessionHostLoadBalancingAlgorithm"]] = None, + ramp_down_minimum_hosts_pct: Optional[int] = None, + ramp_down_capacity_threshold_pct: Optional[int] = None, + ramp_down_force_logoff_users: Optional[bool] = None, + ramp_down_stop_hosts_when: Optional[Union[str, "StopHostsWhen"]] = None, + ramp_down_wait_time_minutes: Optional[int] = None, + ramp_down_notification_message: Optional[str] = None, + off_peak_start_time: Optional["Time"] = None, + off_peak_load_balancing_algorithm: Optional[Union[str, "SessionHostLoadBalancingAlgorithm"]] = None, + **kwargs + ): + super(ScalingSchedule, self).__init__(**kwargs) + self.name = name + self.days_of_week = days_of_week + self.ramp_up_start_time = ramp_up_start_time + self.ramp_up_load_balancing_algorithm = ramp_up_load_balancing_algorithm + self.ramp_up_minimum_hosts_pct = ramp_up_minimum_hosts_pct + self.ramp_up_capacity_threshold_pct = ramp_up_capacity_threshold_pct + self.peak_start_time = peak_start_time + self.peak_load_balancing_algorithm = peak_load_balancing_algorithm + self.ramp_down_start_time = ramp_down_start_time + self.ramp_down_load_balancing_algorithm = ramp_down_load_balancing_algorithm + self.ramp_down_minimum_hosts_pct = ramp_down_minimum_hosts_pct + self.ramp_down_capacity_threshold_pct = ramp_down_capacity_threshold_pct + self.ramp_down_force_logoff_users = ramp_down_force_logoff_users + self.ramp_down_stop_hosts_when = ramp_down_stop_hosts_when + self.ramp_down_wait_time_minutes = ramp_down_wait_time_minutes + self.ramp_down_notification_message = ramp_down_notification_message + self.off_peak_start_time = off_peak_start_time + self.off_peak_load_balancing_algorithm = off_peak_load_balancing_algorithm + + +class SendMessage(msrest.serialization.Model): + """Represents message sent to a UserSession. + + :param message_title: Title of message. + :type message_title: str + :param message_body: Body of message. + :type message_body: str + """ + + _attribute_map = { + 'message_title': {'key': 'messageTitle', 'type': 'str'}, + 'message_body': {'key': 'messageBody', 'type': 'str'}, + } + + def __init__( + self, + *, + message_title: Optional[str] = None, + message_body: Optional[str] = None, + **kwargs + ): + super(SendMessage, self).__init__(**kwargs) + self.message_title = message_title + self.message_body = message_body + + +class ServiceSpecification(msrest.serialization.Model): + """Service specification payload. + + :param log_specifications: Specifications of the Log for Azure Monitoring. + :type log_specifications: list[~desktop_virtualization_api_client.models.LogSpecification] + """ + + _attribute_map = { + 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, + } + + def __init__( + self, + *, + log_specifications: Optional[List["LogSpecification"]] = None, + **kwargs + ): + super(ServiceSpecification, self).__init__(**kwargs) + self.log_specifications = log_specifications + + +class SessionHost(Resource): + """Represents a SessionHost definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of SessionHost. (internal use). + :vartype object_id: str + :param last_heart_beat: Last heart beat from SessionHost. + :type last_heart_beat: ~datetime.datetime + :param sessions: Number of sessions on SessionHost. + :type sessions: int + :param agent_version: Version of agent on SessionHost. + :type agent_version: str + :param allow_new_session: Allow a new session. + :type allow_new_session: bool + :ivar virtual_machine_id: Virtual Machine Id of SessionHost's underlying virtual machine. + :vartype virtual_machine_id: str + :ivar resource_id: Resource Id of SessionHost's underlying virtual machine. + :vartype resource_id: str + :param assigned_user: User assigned to SessionHost. + :type assigned_user: str + :param status: Status for a SessionHost. Possible values include: "Available", "Unavailable", + "Shutdown", "Disconnected", "Upgrading", "UpgradeFailed", "NoHeartbeat", "NotJoinedToDomain", + "DomainTrustRelationshipLost", "SxSStackListenerNotReady", "FSLogixNotHealthy", + "NeedsAssistance". + :type status: str or ~desktop_virtualization_api_client.models.Status + :ivar status_timestamp: The timestamp of the status. + :vartype status_timestamp: ~datetime.datetime + :param os_version: The version of the OS on the session host. + :type os_version: str + :param sx_s_stack_version: The version of the side by side stack on the session host. + :type sx_s_stack_version: str + :param update_state: Update state of a SessionHost. Possible values include: "Initial", + "Pending", "Started", "Succeeded", "Failed". + :type update_state: str or ~desktop_virtualization_api_client.models.UpdateState + :ivar last_update_time: The timestamp of the last update. + :vartype last_update_time: ~datetime.datetime + :param update_error_message: The error message. + :type update_error_message: str + :ivar session_host_health_check_results: List of SessionHostHealthCheckReports. + :vartype session_host_health_check_results: + list[~desktop_virtualization_api_client.models.SessionHostHealthCheckReport] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'virtual_machine_id': {'readonly': True}, + 'resource_id': {'readonly': True}, + 'status_timestamp': {'readonly': True}, + 'last_update_time': {'readonly': True}, + 'session_host_health_check_results': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'last_heart_beat': {'key': 'properties.lastHeartBeat', 'type': 'iso-8601'}, + 'sessions': {'key': 'properties.sessions', 'type': 'int'}, + 'agent_version': {'key': 'properties.agentVersion', 'type': 'str'}, + 'allow_new_session': {'key': 'properties.allowNewSession', 'type': 'bool'}, + 'virtual_machine_id': {'key': 'properties.virtualMachineId', 'type': 'str'}, + 'resource_id': {'key': 'properties.resourceId', 'type': 'str'}, + 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, + 'status': {'key': 'properties.status', 'type': 'str'}, + 'status_timestamp': {'key': 'properties.statusTimestamp', 'type': 'iso-8601'}, + 'os_version': {'key': 'properties.osVersion', 'type': 'str'}, + 'sx_s_stack_version': {'key': 'properties.sxSStackVersion', 'type': 'str'}, + 'update_state': {'key': 'properties.updateState', 'type': 'str'}, + 'last_update_time': {'key': 'properties.lastUpdateTime', 'type': 'iso-8601'}, + 'update_error_message': {'key': 'properties.updateErrorMessage', 'type': 'str'}, + 'session_host_health_check_results': {'key': 'properties.sessionHostHealthCheckResults', 'type': '[SessionHostHealthCheckReport]'}, + } + + def __init__( + self, + *, + last_heart_beat: Optional[datetime.datetime] = None, + sessions: Optional[int] = None, + agent_version: Optional[str] = None, + allow_new_session: Optional[bool] = None, + assigned_user: Optional[str] = None, + status: Optional[Union[str, "Status"]] = None, + os_version: Optional[str] = None, + sx_s_stack_version: Optional[str] = None, + update_state: Optional[Union[str, "UpdateState"]] = None, + update_error_message: Optional[str] = None, + **kwargs + ): + super(SessionHost, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.last_heart_beat = last_heart_beat + self.sessions = sessions + self.agent_version = agent_version + self.allow_new_session = allow_new_session + self.virtual_machine_id = None + self.resource_id = None + self.assigned_user = assigned_user + self.status = status + self.status_timestamp = None + self.os_version = os_version + self.sx_s_stack_version = sx_s_stack_version + self.update_state = update_state + self.last_update_time = None + self.update_error_message = update_error_message + self.session_host_health_check_results = None + + +class SessionHostHealthCheckFailureDetails(msrest.serialization.Model): + """Contains details on the failure. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar message: Failure message: hints on what is wrong and how to recover. + :vartype message: str + :ivar error_code: Error code corresponding for the failure. + :vartype error_code: int + :ivar last_health_check_date_time: The timestamp of the last update. + :vartype last_health_check_date_time: ~datetime.datetime + """ + + _validation = { + 'message': {'readonly': True}, + 'error_code': {'readonly': True}, + 'last_health_check_date_time': {'readonly': True}, + } + + _attribute_map = { + 'message': {'key': 'message', 'type': 'str'}, + 'error_code': {'key': 'errorCode', 'type': 'int'}, + 'last_health_check_date_time': {'key': 'lastHealthCheckDateTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHostHealthCheckFailureDetails, self).__init__(**kwargs) + self.message = None + self.error_code = None + self.last_health_check_date_time = None + + +class SessionHostHealthCheckReport(msrest.serialization.Model): + """The report for session host information. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar health_check_name: Represents the name of the health check operation performed. Possible + values include: "DomainJoinedCheck", "DomainTrustCheck", "FSLogixHealthCheck", + "SxSStackListenerCheck", "UrlsAccessibleCheck", "MonitoringAgentCheck", "DomainReachable", + "WebRTCRedirectorCheck", "SupportedEncryptionCheck", "MetaDataServiceCheck", + "AppAttachHealthCheck". + :vartype health_check_name: str or ~desktop_virtualization_api_client.models.HealthCheckName + :ivar health_check_result: Represents the Health state of the health check we performed. + Possible values include: "Unknown", "HealthCheckSucceeded", "HealthCheckFailed", + "SessionHostShutdown". + :vartype health_check_result: str or + ~desktop_virtualization_api_client.models.HealthCheckResult + :ivar additional_failure_details: Additional detailed information on the failure. + :vartype additional_failure_details: + ~desktop_virtualization_api_client.models.SessionHostHealthCheckFailureDetails + """ + + _validation = { + 'health_check_name': {'readonly': True}, + 'health_check_result': {'readonly': True}, + 'additional_failure_details': {'readonly': True}, + } + + _attribute_map = { + 'health_check_name': {'key': 'healthCheckName', 'type': 'str'}, + 'health_check_result': {'key': 'healthCheckResult', 'type': 'str'}, + 'additional_failure_details': {'key': 'additionalFailureDetails', 'type': 'SessionHostHealthCheckFailureDetails'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHostHealthCheckReport, self).__init__(**kwargs) + self.health_check_name = None + self.health_check_result = None + self.additional_failure_details = None + + +class SessionHostList(msrest.serialization.Model): + """List of SessionHost definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of SessionHost definitions. + :type value: list[~desktop_virtualization_api_client.models.SessionHost] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SessionHost]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["SessionHost"]] = None, + **kwargs + ): + super(SessionHostList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SessionHostPatch(Resource): + """SessionHost properties that can be patched. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param allow_new_session: Allow a new session. + :type allow_new_session: bool + :param assigned_user: User assigned to SessionHost. + :type assigned_user: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'allow_new_session': {'key': 'properties.allowNewSession', 'type': 'bool'}, + 'assigned_user': {'key': 'properties.assignedUser', 'type': 'str'}, + } + + def __init__( + self, + *, + allow_new_session: Optional[bool] = None, + assigned_user: Optional[str] = None, + **kwargs + ): + super(SessionHostPatch, self).__init__(**kwargs) + self.allow_new_session = allow_new_session + self.assigned_user = assigned_user + + +class StartMenuItem(Resource): + """Represents a StartMenuItem definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param app_alias: Alias of StartMenuItem. + :type app_alias: str + :param file_path: Path to the file of StartMenuItem. + :type file_path: str + :param command_line_arguments: Command line arguments for StartMenuItem. + :type command_line_arguments: str + :param icon_path: Path to the icon. + :type icon_path: str + :param icon_index: Index of the icon. + :type icon_index: int + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'app_alias': {'key': 'properties.appAlias', 'type': 'str'}, + 'file_path': {'key': 'properties.filePath', 'type': 'str'}, + 'command_line_arguments': {'key': 'properties.commandLineArguments', 'type': 'str'}, + 'icon_path': {'key': 'properties.iconPath', 'type': 'str'}, + 'icon_index': {'key': 'properties.iconIndex', 'type': 'int'}, + } + + def __init__( + self, + *, + app_alias: Optional[str] = None, + file_path: Optional[str] = None, + command_line_arguments: Optional[str] = None, + icon_path: Optional[str] = None, + icon_index: Optional[int] = None, + **kwargs + ): + super(StartMenuItem, self).__init__(**kwargs) + self.app_alias = app_alias + self.file_path = file_path + self.command_line_arguments = command_line_arguments + self.icon_path = icon_path + self.icon_index = icon_index + + +class StartMenuItemList(msrest.serialization.Model): + """List of StartMenuItem definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of StartMenuItem definitions. + :type value: list[~desktop_virtualization_api_client.models.StartMenuItem] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StartMenuItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["StartMenuItem"]] = None, + **kwargs + ): + super(StartMenuItemList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :param created_by: The identity that created the resource. + :type created_by: str + :param created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :type created_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType + :param created_at: The timestamp of resource creation (UTC). + :type created_at: ~datetime.datetime + :param last_modified_by: The identity that last modified the resource. + :type last_modified_by: str + :param last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :type last_modified_by_type: str or ~desktop_virtualization_api_client.models.CreatedByType + :param last_modified_at: The timestamp of resource last modification (UTC). + :type last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Time(msrest.serialization.Model): + """The time for a scaling action to occur. + + All required parameters must be populated in order to send to Azure. + + :param hour: Required. The hour. + :type hour: int + :param minute: Required. The minute. + :type minute: int + """ + + _validation = { + 'hour': {'required': True, 'maximum': 23, 'minimum': 0}, + 'minute': {'required': True, 'maximum': 59, 'minimum': 0}, + } + + _attribute_map = { + 'hour': {'key': 'hour', 'type': 'int'}, + 'minute': {'key': 'minute', 'type': 'int'}, + } + + def __init__( + self, + *, + hour: int, + minute: int, + **kwargs + ): + super(Time, self).__init__(**kwargs) + self.hour = hour + self.minute = minute + + +class UserSession(Resource): + """Represents a UserSession definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of user session. (internal use). + :vartype object_id: str + :param user_principal_name: The user principal name. + :type user_principal_name: str + :param application_type: Application type of application. Possible values include: "RemoteApp", + "Desktop". + :type application_type: str or ~desktop_virtualization_api_client.models.ApplicationType + :param session_state: State of user session. Possible values include: "Unknown", "Active", + "Disconnected", "Pending", "LogOff", "UserProfileDiskMounted". + :type session_state: str or ~desktop_virtualization_api_client.models.SessionState + :param active_directory_user_name: The active directory user name. + :type active_directory_user_name: str + :param create_time: The timestamp of the user session create. + :type create_time: ~datetime.datetime + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'user_principal_name': {'key': 'properties.userPrincipalName', 'type': 'str'}, + 'application_type': {'key': 'properties.applicationType', 'type': 'str'}, + 'session_state': {'key': 'properties.sessionState', 'type': 'str'}, + 'active_directory_user_name': {'key': 'properties.activeDirectoryUserName', 'type': 'str'}, + 'create_time': {'key': 'properties.createTime', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + user_principal_name: Optional[str] = None, + application_type: Optional[Union[str, "ApplicationType"]] = None, + session_state: Optional[Union[str, "SessionState"]] = None, + active_directory_user_name: Optional[str] = None, + create_time: Optional[datetime.datetime] = None, + **kwargs + ): + super(UserSession, self).__init__(**kwargs) + self.system_data = None + self.object_id = None + self.user_principal_name = user_principal_name + self.application_type = application_type + self.session_state = session_state + self.active_directory_user_name = active_directory_user_name + self.create_time = create_time + + +class UserSessionList(msrest.serialization.Model): + """List of UserSession definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of UserSession definitions. + :type value: list[~desktop_virtualization_api_client.models.UserSession] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[UserSession]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["UserSession"]] = None, + **kwargs + ): + super(UserSessionList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Workspace(ResourceModelWithAllowedPropertySet): + """Represents a Workspace definition. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :param location: The geo-location where the resource lives. + :type location: str + :param managed_by: The fully qualified resource ID of the resource that manages this resource. + Indicates if this resource is managed by another Azure resource. If this is present, complete + mode deployment will not delete the resource if it is removed from the template since it is + managed by another resource. + :type managed_by: str + :param kind: Metadata used by portal/tooling/etc to render different UX experiences for + resources of the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, + the resource provider must validate and persist this value. + :type kind: str + :ivar etag: The etag field is *not* required. If it is provided in the response body, it must + also be provided as a header per the normal etag convention. Entity tags are used for + comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range + (section 14.27) header fields. + :vartype etag: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param identity: + :type identity: + ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetIdentity + :param sku: + :type sku: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetSku + :param plan: + :type plan: ~desktop_virtualization_api_client.models.ResourceModelWithAllowedPropertySetPlan + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~desktop_virtualization_api_client.models.SystemData + :ivar object_id: ObjectId of Workspace. (internal use). + :vartype object_id: str + :param description: Description of Workspace. + :type description: str + :param friendly_name: Friendly name of Workspace. + :type friendly_name: str + :param application_group_references: List of applicationGroup resource Ids. + :type application_group_references: list[str] + :ivar cloud_pc_resource: Is cloud pc resource. + :vartype cloud_pc_resource: bool + :param public_network_access: Enabled allows this resource to be accessed from both public and + private networks, Disabled allows this resource to only be accessed via private endpoints. + Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'kind': {'pattern': r'^[-\w\._,\(\)]+$'}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'object_id': {'readonly': True}, + 'cloud_pc_resource': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'managed_by': {'key': 'managedBy', 'type': 'str'}, + 'kind': {'key': 'kind', 'type': 'str'}, + 'etag': {'key': 'etag', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'identity': {'key': 'identity', 'type': 'ResourceModelWithAllowedPropertySetIdentity'}, + 'sku': {'key': 'sku', 'type': 'ResourceModelWithAllowedPropertySetSku'}, + 'plan': {'key': 'plan', 'type': 'ResourceModelWithAllowedPropertySetPlan'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'object_id': {'key': 'properties.objectId', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + 'cloud_pc_resource': {'key': 'properties.cloudPcResource', 'type': 'bool'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + managed_by: Optional[str] = None, + kind: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ResourceModelWithAllowedPropertySetIdentity"] = None, + sku: Optional["ResourceModelWithAllowedPropertySetSku"] = None, + plan: Optional["ResourceModelWithAllowedPropertySetPlan"] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + application_group_references: Optional[List[str]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + **kwargs + ): + super(Workspace, self).__init__(location=location, managed_by=managed_by, kind=kind, tags=tags, identity=identity, sku=sku, plan=plan, **kwargs) + self.system_data = None + self.object_id = None + self.description = description + self.friendly_name = friendly_name + self.application_group_references = application_group_references + self.cloud_pc_resource = None + self.public_network_access = public_network_access + + +class WorkspaceList(msrest.serialization.Model): + """List of Workspace definitions. + + Variables are only populated by the server, and will be ignored when sending a request. + + :param value: List of Workspace definitions. + :type value: list[~desktop_virtualization_api_client.models.Workspace] + :ivar next_link: Link to the next page of results. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Workspace]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["Workspace"]] = None, + **kwargs + ): + super(WorkspaceList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class WorkspacePatch(msrest.serialization.Model): + """Workspace properties that can be patched. + + :param tags: A set of tags. tags to be updated. + :type tags: dict[str, str] + :param description: Description of Workspace. + :type description: str + :param friendly_name: Friendly name of Workspace. + :type friendly_name: str + :param application_group_references: List of applicationGroup links. + :type application_group_references: list[str] + :param public_network_access: Enabled to allow this resource to be access from the public + network. Possible values include: "Enabled", "Disabled". + :type public_network_access: str or + ~desktop_virtualization_api_client.models.PublicNetworkAccess + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + 'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + application_group_references: Optional[List[str]] = None, + public_network_access: Optional[Union[str, "PublicNetworkAccess"]] = None, + **kwargs + ): + super(WorkspacePatch, self).__init__(**kwargs) + self.tags = tags + self.description = description + self.friendly_name = friendly_name + self.application_group_references = application_group_references + self.public_network_access = public_network_access 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 new file mode 100644 index 000000000000..63576d0654da --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/__init__.py @@ -0,0 +1,39 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operations import Operations +from ._workspaces_operations import WorkspacesOperations +from ._scaling_plans_operations import ScalingPlansOperations +from ._application_groups_operations import ApplicationGroupsOperations +from ._start_menu_items_operations import StartMenuItemsOperations +from ._applications_operations import ApplicationsOperations +from ._desktops_operations import DesktopsOperations +from ._host_pools_operations import HostPoolsOperations +from ._user_sessions_operations import UserSessionsOperations +from ._session_hosts_operations import SessionHostsOperations +from ._msix_packages_operations import MSIXPackagesOperations +from ._msix_images_operations import MsixImagesOperations +from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations +from ._private_link_resources_operations import PrivateLinkResourcesOperations + +__all__ = [ + 'Operations', + 'WorkspacesOperations', + 'ScalingPlansOperations', + 'ApplicationGroupsOperations', + 'StartMenuItemsOperations', + 'ApplicationsOperations', + 'DesktopsOperations', + 'HostPoolsOperations', + 'UserSessionsOperations', + 'SessionHostsOperations', + 'MSIXPackagesOperations', + 'MsixImagesOperations', + 'PrivateEndpointConnectionsOperations', + 'PrivateLinkResourcesOperations', +] 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 new file mode 100644 index 000000000000..35d423413cb7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_application_groups_operations.py @@ -0,0 +1,452 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationGroupsOperations(object): + """ApplicationGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + application_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationGroup" + """Get an application group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGroup, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('ApplicationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_group, # type: "_models.ApplicationGroup" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationGroup" + """Create or update an applicationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_group: Object containing ApplicationGroup definitions. + :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroup + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGroup, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(application_group, 'ApplicationGroup') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationGroup', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ApplicationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + application_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove an applicationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_group=None, # type: Optional["_models.ApplicationGroupPatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationGroup" + """Update an applicationGroup. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_group: Object containing ApplicationGroup definitions. + :type application_group: ~desktop_virtualization_api_client.models.ApplicationGroupPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationGroup, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroup"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if application_group is not None: + body_content = self._serialize.body(application_group, 'ApplicationGroupPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('ApplicationGroup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApplicationGroupList"] + """List applicationGroups. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param filter: OData filter expression. Valid properties for filtering are + applicationGroupType. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationGroupList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore + + def list_by_subscription( + self, + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApplicationGroupList"] + """List applicationGroups in subscription. + + :param filter: OData filter expression. Valid properties for filtering are + applicationGroupType. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationGroupList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ApplicationGroupList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationGroupList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationGroupList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/applicationGroups'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py new file mode 100644 index 000000000000..59dd6449ed15 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_applications_operations.py @@ -0,0 +1,393 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationsOperations(object): + """ApplicationsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Application" + """Get an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_name, # type: str + application, # type: "_models.Application" + **kwargs # type: Any + ): + # type: (...) -> "_models.Application" + """Create or update an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :param application: Object containing Application definitions. + :type application: ~desktop_virtualization_api_client.models.Application + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(application, 'Application') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Application', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_name, # type: str + application=None, # type: Optional["_models.ApplicationPatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Application" + """Update an application. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param application_name: The name of the application within the specified application group. + :type application_name: str + :param application: Object containing Application definitions. + :type application: ~desktop_virtualization_api_client.models.ApplicationPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Application"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'applicationName': self._serialize.url("application_name", application_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if application is not None: + body_content = self._serialize.body(application, 'ApplicationPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('Application', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications/{applicationName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + application_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApplicationList"] + """List applications. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ApplicationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/applications'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py new file mode 100644 index 000000000000..2a315452e564 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_desktops_operations.py @@ -0,0 +1,258 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DesktopsOperations(object): + """DesktopsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + application_group_name, # type: str + desktop_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Desktop" + """Get a desktop. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param desktop_name: The name of the desktop within the specified desktop group. + :type desktop_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Desktop, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('Desktop', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + application_group_name, # type: str + desktop_name, # type: str + desktop=None, # type: Optional["_models.DesktopPatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Desktop" + """Update a desktop. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :param desktop_name: The name of the desktop within the specified desktop group. + :type desktop_name: str + :param desktop: Object containing Desktop definitions. + :type desktop: ~desktop_virtualization_api_client.models.DesktopPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Desktop, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Desktop"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + 'desktopName': self._serialize.url("desktop_name", desktop_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if desktop is not None: + body_content = self._serialize.body(desktop, 'DesktopPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('Desktop', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops/{desktopName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + application_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.DesktopList"] + """List desktops. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DesktopList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.DesktopList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DesktopList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('DesktopList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py new file mode 100644 index 000000000000..12f946b4b400 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_host_pools_operations.py @@ -0,0 +1,504 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class HostPoolsOperations(object): + """HostPoolsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.HostPool" + """Get a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPool, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('HostPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + host_pool, # type: "_models.HostPool" + **kwargs # type: Any + ): + # type: (...) -> "_models.HostPool" + """Create or update a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param host_pool: Object containing HostPool definitions. + :type host_pool: ~desktop_virtualization_api_client.models.HostPool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPool, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(host_pool, 'HostPool') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('HostPool', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('HostPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + host_pool_name, # type: str + force=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + """Remove a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param force: Force flag to delete sessionHost. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + host_pool=None, # type: Optional["_models.HostPoolPatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.HostPool" + """Update a host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param host_pool: Object containing HostPool definitions. + :type host_pool: ~desktop_virtualization_api_client.models.HostPoolPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPool, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPool"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if host_pool is not None: + body_content = self._serialize.body(host_pool, 'HostPoolPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('HostPool', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.HostPoolList"] + """List hostPools. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostPoolList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('HostPoolList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.HostPoolList"] + """List hostPools in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either HostPoolList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.HostPoolList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.HostPoolList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('HostPoolList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/hostPools'} # type: ignore + + def retrieve_registration_token( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.RegistrationInfo" + """Registration token of the host pool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegistrationInfo, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.RegistrationInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegistrationInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.retrieve_registration_token.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('RegistrationInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + retrieve_registration_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/retrieveRegistrationToken'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py new file mode 100644 index 000000000000..4b3888285aae --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_images_operations.py @@ -0,0 +1,132 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MsixImagesOperations(object): + """MsixImagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def expand( + self, + resource_group_name, # type: str + host_pool_name, # type: str + msix_image_uri, # type: "_models.MSIXImageURI" + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ExpandMsixImageList"] + """Expands and Lists MSIX packages in an Image, given the Image Path. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_image_uri: Object containing URI to MSIX Image. + :type msix_image_uri: ~desktop_virtualization_api_client.models.MSIXImageURI + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ExpandMsixImageList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ExpandMsixImageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExpandMsixImageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = "application/json" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.expand.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(msix_image_uri, 'MSIXImageURI') + body_content_kwargs['content'] = body_content + request = self._client.get(url, query_parameters, header_parameters, **body_content_kwargs) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ExpandMsixImageList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + expand.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/expandMsixImage'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py new file mode 100644 index 000000000000..140e1fe0cf52 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_msix_packages_operations.py @@ -0,0 +1,397 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class MSIXPackagesOperations(object): + """MSIXPackagesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + host_pool_name, # type: str + msix_package_full_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.MSIXPackage" + """Get a msixpackage. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSIXPackage, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('MSIXPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + msix_package_full_name, # type: str + msix_package, # type: "_models.MSIXPackage" + **kwargs # type: Any + ): + # type: (...) -> "_models.MSIXPackage" + """Create or update a MSIX package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :param msix_package: Object containing MSIX Package definitions. + :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSIXPackage, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(msix_package, 'MSIXPackage') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('MSIXPackage', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('MSIXPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + host_pool_name, # type: str + msix_package_full_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove an MSIX Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + msix_package_full_name, # type: str + msix_package=None, # type: Optional["_models.MSIXPackagePatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.MSIXPackage" + """Update an MSIX Package. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param msix_package_full_name: The version specific package full name of the MSIX package + within specified hostpool. + :type msix_package_full_name: str + :param msix_package: Object containing MSIX Package definitions. + :type msix_package: ~desktop_virtualization_api_client.models.MSIXPackagePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: MSIXPackage, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.MSIXPackage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'msixPackageFullName': self._serialize.url("msix_package_full_name", msix_package_full_name, 'str', max_length=100, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if msix_package is not None: + body_content = self._serialize.body(msix_package, 'MSIXPackagePatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('MSIXPackage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages/{msixPackageFullName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.MSIXPackageList"] + """List MSIX packages in hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either MSIXPackageList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.MSIXPackageList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.MSIXPackageList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('MSIXPackageList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/msixPackages'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_operations.py new file mode 100644 index 000000000000..0438e92acc25 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_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. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ResourceProviderOperationList"] + """List all of the available operations the Desktop Virtualization resource provider supports. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ResourceProviderOperationList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ResourceProviderOperationList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceProviderOperationList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ResourceProviderOperationList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/providers/Microsoft.DesktopVirtualization/operations'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py new file mode 100644 index 000000000000..cdb369a42e1e --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_endpoint_connections_operations.py @@ -0,0 +1,590 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateEndpointConnectionsOperations(object): + """PrivateEndpointConnectionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_host_pool( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResultWithSystemData"] + """List private endpoint connections associated with hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections'} # type: ignore + + def get_by_host_pool( + self, + resource_group_name, # type: str + host_pool_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + """Get a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def delete_by_host_pool( + self, + resource_group_name, # type: str + host_pool_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def update_by_host_pool( + self, + resource_group_name, # type: str + host_pool_name, # type: str + private_endpoint_connection_name, # type: str + connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + """Approve or reject a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param connection: Object containing the updated connection. + :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateEndpointConnectionListResultWithSystemData"] + """List private endpoint connections. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateEndpointConnectionListResultWithSystemData or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateEndpointConnectionListResultWithSystemData] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionListResultWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateEndpointConnectionListResultWithSystemData', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections'} # type: ignore + + def get_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + """Get a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def delete_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + private_endpoint_connection_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove a connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + + def update_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + private_endpoint_connection_name, # type: str + connection, # type: "_models.PrivateEndpointConnection" + **kwargs # type: Any + ): + # type: (...) -> "_models.PrivateEndpointConnectionWithSystemData" + """Approve or reject a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection associated + with the Azure resource. + :type private_endpoint_connection_name: str + :param connection: Object containing the updated connection. + :type connection: ~desktop_virtualization_api_client.models.PrivateEndpointConnection + :keyword callable cls: A custom type or function that will be passed the direct response + :return: PrivateEndpointConnectionWithSystemData, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.PrivateEndpointConnectionWithSystemData + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionWithSystemData"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + 'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(connection, 'PrivateEndpointConnection') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('PrivateEndpointConnectionWithSystemData', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore 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 new file mode 100644 index 000000000000..21893ee73489 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_private_link_resources_operations.py @@ -0,0 +1,196 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class PrivateLinkResourcesOperations(object): + """PrivateLinkResourcesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_host_pool( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + """List the private link resources available for this hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/privateLinkResources'} # type: ignore + + def list_by_workspace( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.PrivateLinkResourceListResult"] + """List the private link resources available for this workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either PrivateLinkResourceListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.PrivateLinkResourceListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateLinkResourceListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_workspace.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('PrivateLinkResourceListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_workspace.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/privateLinkResources'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py new file mode 100644 index 000000000000..d612336eff64 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_scaling_plans_operations.py @@ -0,0 +1,515 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ScalingPlansOperations(object): + """ScalingPlansOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + scaling_plan_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ScalingPlan" + """Get a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScalingPlan, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('ScalingPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + def create( + self, + resource_group_name, # type: str + scaling_plan_name, # type: str + scaling_plan, # type: "_models.ScalingPlan" + **kwargs # type: Any + ): + # type: (...) -> "_models.ScalingPlan" + """Create or update a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :param scaling_plan: Object containing scaling plan definitions. + :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlan + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScalingPlan, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(scaling_plan, 'ScalingPlan') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('ScalingPlan', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ScalingPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + scaling_plan_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + scaling_plan_name, # type: str + scaling_plan=None, # type: Optional["_models.ScalingPlanPatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.ScalingPlan" + """Update a scaling plan. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param scaling_plan_name: The name of the scaling plan. + :type scaling_plan_name: str + :param scaling_plan: Object containing scaling plan definitions. + :type scaling_plan: ~desktop_virtualization_api_client.models.ScalingPlanPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ScalingPlan, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.ScalingPlan + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlan"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'scalingPlanName': self._serialize.url("scaling_plan_name", scaling_plan_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if scaling_plan is not None: + body_content = self._serialize.body(scaling_plan, 'ScalingPlanPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('ScalingPlan', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans/{scalingPlanName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScalingPlanList"] + """List scaling plans. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScalingPlanList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ScalingPlanList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScalingPlanList"] + """List scaling plans in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScalingPlanList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ScalingPlanList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/scalingPlans'} # type: ignore + + def list_by_host_pool( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ScalingPlanList"] + """List scaling plan associated with hostpool. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ScalingPlanList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.ScalingPlanList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ScalingPlanList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ScalingPlanList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/scalingPlans'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py new file mode 100644 index 000000000000..2480b7d82744 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_session_hosts_operations.py @@ -0,0 +1,328 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SessionHostsOperations(object): + """SessionHostsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.SessionHost" + """Get a session host. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHost, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('SessionHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + force=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + """Remove a SessionHost. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param force: Force flag to force sessionHost deletion even when userSession exists. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + force=None, # type: Optional[bool] + session_host=None, # type: Optional["_models.SessionHostPatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.SessionHost" + """Update a session host. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param force: Force flag to update assign, unassign or reassign personal desktop. + :type force: bool + :param session_host: Object containing SessionHost definitions. + :type session_host: ~desktop_virtualization_api_client.models.SessionHostPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SessionHost, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHost"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if session_host is not None: + body_content = self._serialize.body(session_host, 'SessionHostPatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('SessionHost', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.SessionHostList"] + """List sessionHosts. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SessionHostList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.SessionHostList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SessionHostList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('SessionHostList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py new file mode 100644 index 000000000000..6252ac496e01 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_start_menu_items_operations.py @@ -0,0 +1,121 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class StartMenuItemsOperations(object): + """StartMenuItemsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + resource_group_name, # type: str + application_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.StartMenuItemList"] + """List start menu items in the given application group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param application_group_name: The name of the application group. + :type application_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either StartMenuItemList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.StartMenuItemList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.StartMenuItemList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('StartMenuItemList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/startMenuItems'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py new file mode 100644 index 000000000000..8d2bd84f3da7 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_user_sessions_operations.py @@ -0,0 +1,481 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class UserSessionsOperations(object): + """UserSessionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_host_pool( + self, + resource_group_name, # type: str + host_pool_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.UserSessionList"] + """List userSessions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param filter: OData filter expression. Valid properties for filtering are userprincipalname + and sessionstate. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserSessionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('UserSessionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_host_pool.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/userSessions'} # type: ignore + + def get( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + user_session_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.UserSession" + """Get a userSession. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: UserSession, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.UserSession + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSession"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('UserSession', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + user_session_id, # type: str + force=None, # type: Optional[bool] + **kwargs # type: Any + ): + # type: (...) -> None + """Remove a userSession. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :param force: Force flag to login off userSession. + :type force: bool + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.UserSessionList"] + """List userSessions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either UserSessionList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.UserSessionList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.UserSessionList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('UserSessionList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions'} # type: ignore + + def disconnect( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + user_session_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Disconnect a userSession. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.disconnect.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.post(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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, {}) + + disconnect.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/disconnect'} # type: ignore + + def send_message( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + user_session_id, # type: str + send_message=None, # type: Optional["_models.SendMessage"] + **kwargs # type: Any + ): + # type: (...) -> None + """Send a message to a user. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param host_pool_name: The name of the host pool within the specified resource group. + :type host_pool_name: str + :param session_host_name: The name of the session host within the specified host pool. + :type session_host_name: str + :param user_session_id: The name of the user session within the specified session host. + :type user_session_id: str + :param send_message: Object containing message includes title and message body. + :type send_message: ~desktop_virtualization_api_client.models.SendMessage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.send_message.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=64, min_length=3), + 'sessionHostName': self._serialize.url("session_host_name", session_host_name, 'str', max_length=48, min_length=3), + 'userSessionId': self._serialize.url("user_session_id", user_session_id, 'str', max_length=24, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if send_message is not None: + body_content = self._serialize.body(send_message, 'SendMessage') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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, {}) + + send_message.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/userSessions/{userSessionId}/sendMessage'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py new file mode 100644 index 000000000000..909e892418f0 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/operations/_workspaces_operations.py @@ -0,0 +1,440 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class WorkspacesOperations(object): + """WorkspacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~desktop_virtualization_api_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.Workspace" + """Get a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **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('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + def create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + workspace, # type: "_models.Workspace" + **kwargs # type: Any + ): + # type: (...) -> "_models.Workspace" + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param workspace: Object containing Workspace definitions. + :type workspace: ~desktop_virtualization_api_client.models.Workspace + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + body_content = self._serialize.body(workspace, 'Workspace') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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) + + if response.status_code == 200: + deserialized = self._deserialize('Workspace', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + def delete( + self, + resource_group_name, # type: str + workspace_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + """Remove a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + # Construct URL + url = self.delete.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + 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, {}) + + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + workspace_name, # type: str + workspace=None, # type: Optional["_models.WorkspacePatch"] + **kwargs # type: Any + ): + # type: (...) -> "_models.Workspace" + """Update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param workspace_name: The name of the workspace. + :type workspace_name: str + :param workspace: Object containing Workspace definitions. + :type workspace: ~desktop_virtualization_api_client.models.WorkspacePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace, or the result of cls(response) + :rtype: ~desktop_virtualization_api_client.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Workspace"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=64, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + body_content_kwargs = {} # type: Dict[str, Any] + if workspace is not None: + body_content = self._serialize.body(workspace, 'WorkspacePatch') + else: + body_content = None + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + 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('Workspace', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}'} # type: ignore + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkspaceList"] + """List workspaces. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.WorkspaceList"] + """List workspaces in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either WorkspaceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~desktop_virtualization_api_client.models.WorkspaceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkspaceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-09-03-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('WorkspaceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **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 + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.DesktopVirtualization/workspaces'} # type: ignore diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/py.typed b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/azure/mgmt/desktopvirtualization/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/sdk_packaging.toml b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/sdk_packaging.toml new file mode 100644 index 000000000000..512f73b6df0d --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-desktopvirtualization" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "MyService Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.cfg b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py new file mode 100644 index 000000000000..049aafb2c3e8 --- /dev/null +++ b/sdk/desktopvirtualization/azure-mgmt-desktopvirtualization/setup.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-desktopvirtualization" +PACKAGE_PPRINT_NAME = "MyService Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.2.0,<2.0.0', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/desktopvirtualization/ci.yml b/sdk/desktopvirtualization/ci.yml new file mode 100644 index 000000000000..c5752433bbf2 --- /dev/null +++ b/sdk/desktopvirtualization/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/desktopvirtualization/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/desktopvirtualization/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: desktopvirtualization + Artifacts: + - name: azure-mgmt-desktopvirtualization + safeName: azuremgmtdesktopvirtualization