diff --git a/src/desktopvirtualization/HISTORY.rst b/src/desktopvirtualization/HISTORY.rst new file mode 100644 index 00000000000..27f152061e8 --- /dev/null +++ b/src/desktopvirtualization/HISTORY.rst @@ -0,0 +1,8 @@ +.. :changelog: + +Release History +=============== + +0.1.0 +++++++ +* Initial release. diff --git a/src/desktopvirtualization/README.md b/src/desktopvirtualization/README.md new file mode 100644 index 00000000000..60802cd64fd --- /dev/null +++ b/src/desktopvirtualization/README.md @@ -0,0 +1,5 @@ +Microsoft Azure CLI 'desktopvirtualization' Extension +========================================== + +This package is for the 'desktopvirtualization' extension. +i.e. 'az desktopvirtualization' diff --git a/src/desktopvirtualization/azext_desktopvirtualization/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/__init__.py new file mode 100644 index 00000000000..0e08014582b --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/__init__.py @@ -0,0 +1,46 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core import AzCommandsLoader +from azext_desktopvirtualization.generated._help import helps # pylint: disable=unused-import + + +class DesktopVirtualizationAPIClientCommandsLoader(AzCommandsLoader): + + def __init__(self, cli_ctx=None): + from azure.cli.core.commands import CliCommandType + from azext_desktopvirtualization.generated._client_factory import cf_desktopvirtualization + desktopvirtualization_custom = CliCommandType( + operations_tmpl='azext_desktopvirtualization.custom#{}', + client_factory=cf_desktopvirtualization) + super(DesktopVirtualizationAPIClientCommandsLoader, self).__init__(cli_ctx=cli_ctx, + custom_command_type=desktopvirtualization_custom) + + def load_command_table(self, args): + from azext_desktopvirtualization.generated.commands import load_command_table + load_command_table(self, args) + try: + from azext_desktopvirtualization.manual.commands import load_command_table as load_command_table_manual + load_command_table_manual(self, args) + except ImportError: + pass + return self.command_table + + def load_arguments(self, command): + from azext_desktopvirtualization.generated._params import load_arguments + load_arguments(self, command) + try: + from azext_desktopvirtualization.manual._params import load_arguments as load_arguments_manual + load_arguments_manual(self, command) + except ImportError: + pass + + +COMMAND_LOADER_CLS = DesktopVirtualizationAPIClientCommandsLoader diff --git a/src/desktopvirtualization/azext_desktopvirtualization/action.py b/src/desktopvirtualization/azext_desktopvirtualization/action.py new file mode 100644 index 00000000000..a846b2766c4 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/action.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.action import * # noqa: F403 +try: + from .manual.action import * # noqa: F403 +except ImportError: + pass diff --git a/src/desktopvirtualization/azext_desktopvirtualization/azext_metadata.json b/src/desktopvirtualization/azext_desktopvirtualization/azext_metadata.json new file mode 100644 index 00000000000..7b56fb1e11a --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/azext_metadata.json @@ -0,0 +1,4 @@ +{ + "azext.isExperimental": true, + "azext.minCliCoreVersion": "2.3.1" +} \ No newline at end of file diff --git a/src/desktopvirtualization/azext_desktopvirtualization/custom.py b/src/desktopvirtualization/azext_desktopvirtualization/custom.py new file mode 100644 index 00000000000..7f31674ce96 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/custom.py @@ -0,0 +1,17 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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. +# -------------------------------------------------------------------------- +# pylint: disable=wildcard-import +# pylint: disable=unused-wildcard-import + +from .generated.custom import * # noqa: F403 +try: + from .manual.custom import * # noqa: F403 +except ImportError: + pass diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/_client_factory.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/_client_factory.py new file mode 100644 index 00000000000..cfc5610645b --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/_client_factory.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + + +def cf_desktopvirtualization(cli_ctx, *_): + from azure.cli.core.commands.client_factory import get_mgmt_service_client + from ..vendored_sdks.desktopvirtualization import DesktopVirtualizationAPIClient + return get_mgmt_service_client(cli_ctx, DesktopVirtualizationAPIClient) + + +def cf_workspace(cli_ctx, *_): + return cf_desktopvirtualization(cli_ctx).workspace + + +def cf_application_group(cli_ctx, *_): + return cf_desktopvirtualization(cli_ctx).application_group + + +def cf_host_pool(cli_ctx, *_): + return cf_desktopvirtualization(cli_ctx).host_pool diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/_help.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/_help.py new file mode 100644 index 00000000000..fd96de6de72 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/_help.py @@ -0,0 +1,182 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +from knack.help_files import helps + + +helps['desktopvirtualization workspace'] = """ + type: group + short-summary: desktopvirtualization workspace +""" + +helps['desktopvirtualization workspace list'] = """ + type: command + short-summary: List workspaces in subscription. + examples: + - name: Workspace_ListByResourceGroup + text: |- + az desktopvirtualization workspace list --resource-group "resourceGroup1" +""" + +helps['desktopvirtualization workspace show'] = """ + type: command + short-summary: Get a workspace. + examples: + - name: Workspace_Get + text: |- + az desktopvirtualization workspace show --resource-group "resourceGroup1" --workspace-name "workspace1" +""" + +helps['desktopvirtualization workspace create'] = """ + type: command + short-summary: Create or update a workspace. + examples: + - name: Workspace_Create + text: |- + az desktopvirtualization workspace create --resource-group "resourceGroup1" --location "centralus" --des\ +cription "des1" --friendly-name "friendly" --tags tag1="value1" tag2="value2" --workspace-name "workspace1" +""" + +helps['desktopvirtualization workspace update'] = """ + type: command + short-summary: Update a workspace. + examples: + - name: Workspace_Update + text: |- + az desktopvirtualization workspace update --resource-group "resourceGroup1" --description "des1" --frien\ +dly-name "friendly" --tags "{\\"tag1\\":\\"value1\\",\\"tag2\\":\\"value2\\"}" --workspace-name "workspace1" +""" + +helps['desktopvirtualization workspace delete'] = """ + type: command + short-summary: Remove a workspace. + examples: + - name: Workspace_Delete + text: |- + az desktopvirtualization workspace delete --resource-group "resourceGroup1" --workspace-name "workspace1\ +" +""" + +helps['desktopvirtualization applicationgroup'] = """ + type: group + short-summary: desktopvirtualization applicationgroup +""" + +helps['desktopvirtualization applicationgroup list'] = """ + type: command + short-summary: List applicationGroups in subscription. + examples: + - name: ApplicationGroup_ListByResourceGroup + text: |- + az desktopvirtualization applicationgroup list --filter "applicationGroupType eq \'RailApplication\'" --\ +resource-group "resourceGroup1" +""" + +helps['desktopvirtualization applicationgroup show'] = """ + type: command + short-summary: Get an application group. + examples: + - name: ApplicationGroup_Get + text: |- + az desktopvirtualization applicationgroup show --application-group-name "applicationGroup1" --resource-g\ +roup "resourceGroup1" +""" + +helps['desktopvirtualization applicationgroup create'] = """ + type: command + short-summary: Create or update an applicationGroup. + examples: + - name: ApplicationGroup_Create + text: |- + az desktopvirtualization applicationgroup create --location "centralus" --description "des1" --applicati\ +on-group-type "RemoteApp" --friendly-name "friendly" --host-pool-arm-path "/subscriptions/daefabc0-95b4-48b3-b645-8a753\ +a63c4fa/resourceGroups/resourceGroup1/providers/Microsoft.DesktopVirtualization/hostPools/hostPool1" --tags tag1="value\ +1" tag2="value2" --application-group-name "applicationGroup1" --resource-group "resourceGroup1" +""" + +helps['desktopvirtualization applicationgroup update'] = """ + type: command + short-summary: Update an applicationGroup. + examples: + - name: ApplicationGroups_Update + text: |- + az desktopvirtualization applicationgroup update --description "des1" --friendly-name "friendly" --tags \ +"{\\"tag1\\":\\"value1\\",\\"tag2\\":\\"value2\\"}" --application-group-name "applicationGroup1" --resource-group "reso\ +urceGroup1" +""" + +helps['desktopvirtualization applicationgroup delete'] = """ + type: command + short-summary: Remove an applicationGroup. + examples: + - name: ApplicationGroup_Delete + text: |- + az desktopvirtualization applicationgroup delete --application-group-name "applicationGroup1" --resource\ +-group "resourceGroup1" +""" + +helps['desktopvirtualization hostpool'] = """ + type: group + short-summary: desktopvirtualization hostpool +""" + +helps['desktopvirtualization hostpool list'] = """ + type: command + short-summary: List hostPools in subscription. + examples: + - name: HostPool_ListByResourceGroup + text: |- + az desktopvirtualization hostpool list --resource-group "resourceGroup1" +""" + +helps['desktopvirtualization hostpool show'] = """ + type: command + short-summary: Get a host pool. + examples: + - name: HostPool_Get + text: |- + az desktopvirtualization hostpool show --host-pool-name "hostPool1" --resource-group "resourceGroup1" +""" + +helps['desktopvirtualization hostpool create'] = """ + type: command + short-summary: Create or update a host pool. + examples: + - name: HostPool_Create + text: |- + az desktopvirtualization hostpool create --location "centralus" --description "des1" --friendly-name "fr\ +iendly" --host-pool-type "Pooled" --load-balancer-type "BreadthFirst" --max-session-limit 999999 --personal-desktop-ass\ +ignment-type "Automatic" --registration-info expiration-time="2020-10-01T14:01:54.9571247Z" registration-token-operatio\ +n="Update" --sso-context "KeyVaultPath" --tags tag1="value1" tag2="value2" --host-pool-name "hostPool1" --resource-grou\ +p "resourceGroup1" +""" + +helps['desktopvirtualization hostpool update'] = """ + type: command + short-summary: Update a host pool. + examples: + - name: HostPool_Update + text: |- + az desktopvirtualization hostpool update --description "des1" --friendly-name "friendly" --load-balancer\ +-type "BreadthFirst" --max-session-limit 999999 --personal-desktop-assignment-type "Automatic" --registration-info expi\ +ration-time="2020-10-01T15:01:54.9571247Z" registration-token-operation="Update" --sso-context "KeyVaultPath" --tags "{\ +\\"tag1\\":\\"value1\\",\\"tag2\\":\\"value2\\"}" --host-pool-name "hostPool1" --resource-group "resourceGroup1" +""" + +helps['desktopvirtualization hostpool delete'] = """ + type: command + short-summary: Remove a host pool. + examples: + - name: HostPool_Delete + text: |- + az desktopvirtualization hostpool delete --force true --host-pool-name "hostPool1" --resource-group "res\ +ourceGroup1" +""" diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/_params.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/_params.py new file mode 100644 index 00000000000..5911ed54a8c --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/_params.py @@ -0,0 +1,145 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines +# pylint: disable=too-many-statements + +from knack.arguments import CLIArgumentType +from azure.cli.core.commands.parameters import ( + tags_type, + get_three_state_flag, + get_enum_type, + resource_group_name_type, + get_location_type +) +from azure.cli.core.commands.validators import get_default_location_from_resource_group +from azext_desktopvirtualization.action import ( + AddDesktopvirtualizationHostpoolCreateRegistrationInfo, + AddDesktopvirtualizationHostpoolUpdateRegistrationInfo +) + + +def load_arguments(self, _): + + with self.argument_context('desktopvirtualization workspace list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('desktopvirtualization workspace show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace') + + with self.argument_context('desktopvirtualization workspace create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('description', help='Description of Workspace.') + c.argument('friendly_name', help='Friendly name of Workspace.') + c.argument('application_group_references', nargs='+', help='List of applicationGroup resource Ids. Expected val' + 'ue: json-string/@json-file.') + + with self.argument_context('desktopvirtualization workspace update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace') + c.argument('tags', tags_type) + c.argument('description', help='Description of Workspace.') + c.argument('friendly_name', help='Friendly name of Workspace.') + c.argument('application_group_references', nargs='+', help='List of applicationGroup links. Expected value: jso' + 'n-string/@json-file.') + + with self.argument_context('desktopvirtualization workspace delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('workspace_name', help='The name of the workspace') + + with self.argument_context('desktopvirtualization applicationgroup list') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('filter', help='OData filter expression. Valid properties for filtering are applicationGroupType.') + + with self.argument_context('desktopvirtualization applicationgroup show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('application_group_name', help='The name of the application group') + + with self.argument_context('desktopvirtualization applicationgroup create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('application_group_name', help='The name of the application group') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('description', help='Description of ApplicationGroup.') + c.argument('friendly_name', help='Friendly name of ApplicationGroup.') + c.argument('host_pool_arm_path', help='HostPool arm path of ApplicationGroup.') + c.argument('application_group_type', arg_type=get_enum_type(['RemoteApp', 'Desktop']), help='Resource Type of A' + 'pplicationGroup.') + + with self.argument_context('desktopvirtualization applicationgroup update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('application_group_name', help='The name of the application group') + c.argument('tags', tags_type) + c.argument('description', help='Description of ApplicationGroup.') + c.argument('friendly_name', help='Friendly name of ApplicationGroup.') + + with self.argument_context('desktopvirtualization applicationgroup delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('application_group_name', help='The name of the application group') + + with self.argument_context('desktopvirtualization hostpool list') as c: + c.argument('resource_group_name', resource_group_name_type) + + with self.argument_context('desktopvirtualization hostpool show') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('host_pool_name', help='The name of the host pool within the specified resource group') + + with self.argument_context('desktopvirtualization hostpool create') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('host_pool_name', help='The name of the host pool within the specified resource group') + c.argument('tags', tags_type) + c.argument('location', arg_type=get_location_type(self.cli_ctx), + validator=get_default_location_from_resource_group) + c.argument('friendly_name', help='Friendly name of HostPool.') + c.argument('description', help='Description of HostPool.') + c.argument('host_pool_type', arg_type=get_enum_type(['Personal', 'Pooled']), + help='HostPool type for desktop.') + c.argument('personal_desktop_assignment_type', arg_type=get_enum_type(['Automatic', 'Direct']), help='PersonalD' + 'esktopAssignment type for HostPool.') + c.argument('custom_rdp_property', help='Custom rdp property of HostPool.') + c.argument('max_session_limit', help='The max session limit of HostPool.') + c.argument('load_balancer_type', arg_type=get_enum_type(['BreadthFirst', 'DepthFirst', 'Persistent']), help='Th' + 'e type of the load balancer.') + c.argument('ring', help='The ring number of HostPool.') + c.argument('validation_environment', arg_type=get_three_state_flag(), help='Is validation environment.') + c.argument('registration_info', action=AddDesktopvirtualizationHostpoolCreateRegistrationInfo, nargs='+', + help='The registration info of HostPool. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs ' + 'are: expiration-time, token, registration-token-operation.') + c.argument('vm_template', help='VM template for sessionhosts configuration within hostpool.') + c.argument('sso_context', help='Path to keyvault containing ssoContext secret.') + + with self.argument_context('desktopvirtualization hostpool update') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('host_pool_name', help='The name of the host pool within the specified resource group') + c.argument('tags', tags_type) + c.argument('friendly_name', help='Friendly name of HostPool.') + c.argument('description', help='Description of HostPool.') + c.argument('custom_rdp_property', help='Custom rdp property of HostPool.') + c.argument('max_session_limit', help='The max session limit of HostPool.') + c.argument('personal_desktop_assignment_type', arg_type=get_enum_type(['Automatic', 'Direct']), help='PersonalD' + 'esktopAssignment type for HostPool.') + c.argument('load_balancer_type', arg_type=get_enum_type(['BreadthFirst', 'DepthFirst', 'Persistent']), help='Th' + 'e type of the load balancer.') + c.argument('ring', help='The ring number of HostPool.') + c.argument('validation_environment', arg_type=get_three_state_flag(), help='Is validation environment.') + c.argument('registration_info', action=AddDesktopvirtualizationHostpoolUpdateRegistrationInfo, nargs='+', + help='The registration info of HostPool. Expect value: KEY1=VALUE1 KEY2=VALUE2 ... , available KEYs ' + 'are: expiration-time, registration-token-operation.') + c.argument('sso_context', help='Path to keyvault containing ssoContext secret.') + + with self.argument_context('desktopvirtualization hostpool delete') as c: + c.argument('resource_group_name', resource_group_name_type) + c.argument('host_pool_name', help='The name of the host pool within the specified resource group') + c.argument('force', arg_type=get_three_state_flag(), help='Force flag to delete sessionHost.') diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/_validators.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/_validators.py new file mode 100644 index 00000000000..7536d0531ea --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/_validators.py @@ -0,0 +1,23 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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. +# -------------------------------------------------------------------------- + + +def example_name_or_id_validator(cmd, namespace): + from azure.cli.core.commands.client_factory import get_subscription_id + from msrestazure.tools import is_valid_resource_id, resource_id + if namespace.storage_account: + if not is_valid_resource_id(namespace.RESOURCE): + namespace.storage_account = resource_id( + subscription=get_subscription_id(cmd.cli_ctx), + resource_group=namespace.resource_group_name, + namespace='Microsoft.Storage', + type='storageAccounts', + name=namespace.storage_account + ) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/action.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/action.py new file mode 100644 index 00000000000..d383947f226 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/action.py @@ -0,0 +1,66 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access + +import argparse +from knack.util import CLIError +from collections import defaultdict + + +class AddDesktopvirtualizationHostpoolCreateRegistrationInfo(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.registration_info = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'expiration-time': + d['expiration_time'] = v[0] + elif kl == 'token': + d['token'] = v[0] + elif kl == 'registration-token-operation': + d['registration_token_operation'] = v[0] + return d + + +class AddDesktopvirtualizationHostpoolUpdateRegistrationInfo(argparse.Action): + def __call__(self, parser, namespace, values, option_string=None): + action = self.get_action(values, option_string) + namespace.registration_info = action + + + def get_action(self, values, option_string): # pylint: disable=no-self-use + try: + properties = defaultdict(list) + for (k, v) in (x.split('=', 1) for x in values): + properties[k].append(v) + properties = dict(properties) + except ValueError: + raise CLIError('usage error: {} [KEY=VALUE ...]'.format(option_string)) + d = {} + for k in properties: + kl = k.lower() + v = properties[k] + if kl == 'expiration-time': + d['expiration_time'] = v[0] + elif kl == 'registration-token-operation': + d['registration_token_operation'] = v[0] + return d diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/commands.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/commands.py new file mode 100644 index 00000000000..5aa138a00c9 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/commands.py @@ -0,0 +1,53 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +from azure.cli.core.commands import CliCommandType + + +def load_command_table(self, _): + + from azext_desktopvirtualization.generated._client_factory import cf_workspace + desktopvirtualization_workspace = CliCommandType( + operations_tmpl='azext_desktopvirtualization.vendored_sdks.desktopvirtualization.operations._workspace_operatio' + 'ns#WorkspaceOperations.{}', + client_factory=cf_workspace) + with self.command_group('desktopvirtualization workspace', desktopvirtualization_workspace, + client_factory=cf_workspace, is_experimental=True) as g: + g.custom_command('list', 'desktopvirtualization_workspace_list') + g.custom_show_command('show', 'desktopvirtualization_workspace_show') + g.custom_command('create', 'desktopvirtualization_workspace_create') + g.custom_command('update', 'desktopvirtualization_workspace_update') + g.custom_command('delete', 'desktopvirtualization_workspace_delete') + + from azext_desktopvirtualization.generated._client_factory import cf_application_group + desktopvirtualization_application_group = CliCommandType( + operations_tmpl='azext_desktopvirtualization.vendored_sdks.desktopvirtualization.operations._application_group_' + 'operations#ApplicationGroupOperations.{}', + client_factory=cf_application_group) + with self.command_group('desktopvirtualization applicationgroup', desktopvirtualization_application_group, + client_factory=cf_application_group, is_experimental=True) as g: + g.custom_command('list', 'desktopvirtualization_applicationgroup_list') + g.custom_show_command('show', 'desktopvirtualization_applicationgroup_show') + g.custom_command('create', 'desktopvirtualization_applicationgroup_create') + g.custom_command('update', 'desktopvirtualization_applicationgroup_update') + g.custom_command('delete', 'desktopvirtualization_applicationgroup_delete') + + from azext_desktopvirtualization.generated._client_factory import cf_host_pool + desktopvirtualization_host_pool = CliCommandType( + operations_tmpl='azext_desktopvirtualization.vendored_sdks.desktopvirtualization.operations._host_pool_operatio' + 'ns#HostPoolOperations.{}', + client_factory=cf_host_pool) + with self.command_group('desktopvirtualization hostpool', desktopvirtualization_host_pool, + client_factory=cf_host_pool, is_experimental=True) as g: + g.custom_command('list', 'desktopvirtualization_hostpool_list') + g.custom_show_command('show', 'desktopvirtualization_hostpool_show') + g.custom_command('create', 'desktopvirtualization_hostpool_create') + g.custom_command('update', 'desktopvirtualization_hostpool_update') + g.custom_command('delete', 'desktopvirtualization_hostpool_delete') diff --git a/src/desktopvirtualization/azext_desktopvirtualization/generated/custom.py b/src/desktopvirtualization/azext_desktopvirtualization/generated/custom.py new file mode 100644 index 00000000000..f1bf4690a78 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/generated/custom.py @@ -0,0 +1,217 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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. +# -------------------------------------------------------------------------- +# pylint: disable=too-many-lines + +import json + + +def desktopvirtualization_workspace_list(cmd, client, + resource_group_name=None): + if resource_group_name is not None: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list_by_subscription() + + +def desktopvirtualization_workspace_show(cmd, client, + resource_group_name, + workspace_name): + return client.get(resource_group_name=resource_group_name, + workspace_name=workspace_name) + + +def desktopvirtualization_workspace_create(cmd, client, + resource_group_name, + workspace_name, + location, + tags=None, + description=None, + friendly_name=None, + application_group_references=None): + if isinstance(application_group_references, str): + application_group_references = json.loads(application_group_references) + return client.create_or_update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + tags=tags, + location=location, + description=description, + friendly_name=friendly_name, + application_group_references=application_group_references) + + +def desktopvirtualization_workspace_update(cmd, client, + resource_group_name, + workspace_name, + tags=None, + description=None, + friendly_name=None, + application_group_references=None): + if isinstance(tags, str): + tags = json.loads(tags) + if isinstance(application_group_references, str): + application_group_references = json.loads(application_group_references) + return client.update(resource_group_name=resource_group_name, + workspace_name=workspace_name, + tags=tags, + description=description, + friendly_name=friendly_name, + application_group_references=application_group_references) + + +def desktopvirtualization_workspace_delete(cmd, client, + resource_group_name, + workspace_name): + return client.delete(resource_group_name=resource_group_name, + workspace_name=workspace_name) + + +def desktopvirtualization_applicationgroup_list(cmd, client, + resource_group_name=None, + filter=None): + if resource_group_name is not None: + return client.list_by_resource_group(resource_group_name=resource_group_name, + filter=filter) + return client.list_by_subscription(filter=filter) + + +def desktopvirtualization_applicationgroup_show(cmd, client, + resource_group_name, + application_group_name): + return client.get(resource_group_name=resource_group_name, + application_group_name=application_group_name) + + +def desktopvirtualization_applicationgroup_create(cmd, client, + resource_group_name, + application_group_name, + location, + host_pool_arm_path, + application_group_type, + tags=None, + description=None, + friendly_name=None): + return client.create_or_update(resource_group_name=resource_group_name, + application_group_name=application_group_name, + tags=tags, + location=location, + description=description, + friendly_name=friendly_name, + host_pool_arm_path=host_pool_arm_path, + application_group_type=application_group_type) + + +def desktopvirtualization_applicationgroup_update(cmd, client, + resource_group_name, + application_group_name, + tags=None, + description=None, + friendly_name=None): + if isinstance(tags, str): + tags = json.loads(tags) + return client.update(resource_group_name=resource_group_name, + application_group_name=application_group_name, + tags=tags, + description=description, + friendly_name=friendly_name) + + +def desktopvirtualization_applicationgroup_delete(cmd, client, + resource_group_name, + application_group_name): + return client.delete(resource_group_name=resource_group_name, + application_group_name=application_group_name) + + +def desktopvirtualization_hostpool_list(cmd, client, + resource_group_name=None): + if resource_group_name is not None: + return client.list_by_resource_group(resource_group_name=resource_group_name) + return client.list() + + +def desktopvirtualization_hostpool_show(cmd, client, + resource_group_name, + host_pool_name): + return client.get(resource_group_name=resource_group_name, + host_pool_name=host_pool_name) + + +def desktopvirtualization_hostpool_create(cmd, client, + resource_group_name, + host_pool_name, + location, + host_pool_type, + personal_desktop_assignment_type, + load_balancer_type, + tags=None, + friendly_name=None, + description=None, + custom_rdp_property=None, + max_session_limit=None, + ring=None, + validation_environment=None, + registration_info=None, + vm_template=None, + sso_context=None): + return client.create_or_update(resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + tags=tags, + location=location, + friendly_name=friendly_name, + description=description, + host_pool_type=host_pool_type, + personal_desktop_assignment_type=personal_desktop_assignment_type, + custom_rdp_property=custom_rdp_property, + max_session_limit=max_session_limit, + load_balancer_type=load_balancer_type, + ring=ring, + validation_environment=validation_environment, + registration_info=registration_info, + vm_template=vm_template, + sso_context=sso_context) + + +def desktopvirtualization_hostpool_update(cmd, client, + resource_group_name, + host_pool_name, + tags=None, + friendly_name=None, + description=None, + custom_rdp_property=None, + max_session_limit=None, + personal_desktop_assignment_type=None, + load_balancer_type=None, + ring=None, + validation_environment=None, + registration_info=None, + sso_context=None): + if isinstance(tags, str): + tags = json.loads(tags) + return client.update(resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + tags=tags, + friendly_name=friendly_name, + description=description, + custom_rdp_property=custom_rdp_property, + max_session_limit=max_session_limit, + personal_desktop_assignment_type=personal_desktop_assignment_type, + load_balancer_type=load_balancer_type, + ring=ring, + validation_environment=validation_environment, + registration_info=registration_info, + sso_context=sso_context) + + +def desktopvirtualization_hostpool_delete(cmd, client, + resource_group_name, + host_pool_name, + force=None): + return client.delete(resource_group_name=resource_group_name, + host_pool_name=host_pool_name, + force=force) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/manual/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/manual/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/manual/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/tests/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/tests/__init__.py new file mode 100644 index 00000000000..fe1bd438b46 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/tests/__init__.py @@ -0,0 +1,49 @@ +# 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 inspect +import os + + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) + + +def try_manual(func): + def import_manual_function(origin_func): + from importlib import import_module + decorated_path = inspect.getfile(origin_func) + module_path = __path__[0] + if not decorated_path.startswith(module_path): + raise Exception("Decorator can only be used in submodules!") + manual_path = os.path.join( + decorated_path[module_path.rfind(os.path.sep) + 1:]) + manual_file_path, manual_file_name = os.path.split(manual_path) + module_name, _ = os.path.splitext(manual_file_name) + manual_module = "..manual." + \ + ".".join(manual_file_path.split(os.path.sep) + [module_name, ]) + return getattr(import_module(manual_module, package=__name__), origin_func.__name__) + + def get_func_to_call(): + func_to_call = func + try: + func_to_call = import_manual_function(func) + except (ImportError, AttributeError): + pass + return func_to_call + + def wrapper(*args, **kwargs): + func_to_call = get_func_to_call() + print("running {}()...".format(func.__name__)) + return func_to_call(*args, **kwargs) + + if inspect.isclass(func): + return get_func_to_call() + else: + return wrapper diff --git a/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/preparers.py b/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/preparers.py new file mode 100644 index 00000000000..3d6672de64f --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/preparers.py @@ -0,0 +1,116 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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 os +from datetime import datetime +from azure.cli.testsdk.preparers import NoTrafficRecordingPreparer +from azure_devtools.scenario_tests import SingleValueReplacer +from azure.cli.testsdk.exceptions import CliTestError +from azure.cli.testsdk.reverse_dependency import get_dummy_cli + + +KEY_RESOURCE_GROUP = 'rg' +KEY_VIRTUAL_NETWORK = 'vnet' +KEY_VNET_SUBNET = 'subnet' + + +class VirtualNetworkPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='virtual_network', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + dev_setting_name='AZURE_CLI_TEST_DEV_VIRTUAL_NETWORK_NAME', + random_name_length=24, key=KEY_VIRTUAL_NETWORK): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VirtualNetworkPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + + tags = {'product': 'azurecli', 'cause': 'automation', + 'date': datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')} + if 'ENV_JOB_NAME' in os.environ: + tags['job'] = os.environ['ENV_JOB_NAME'] + tags = ' '.join(['{}={}'.format(key, value) + for key, value in tags.items()]) + template = 'az network vnet create --resource-group {} --name {} --tag ' + tags + self.live_only_execute(self.cli_ctx, template.format( + self.resource_group_name, name)) + + self.test_class_instance.kwargs[self.key] = name + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + # delete vnet if test is being recorded and if the vnet is not a dev rg + if not self.dev_setting_name: + self.live_only_execute( + self.cli_ctx, 'az network vnet delete --name {} --resource-group {}'.format(name, self.resource_group_name)) + + +class VnetSubnetPreparer(NoTrafficRecordingPreparer, SingleValueReplacer): + def __init__(self, name_prefix='clitest.vn', + parameter_name='subnet', + resource_group_name=None, + resource_group_key=KEY_RESOURCE_GROUP, + vnet_name=None, + vnet_key=KEY_VIRTUAL_NETWORK, + address_prefixes="11.0.0.0/24", + dev_setting_name='AZURE_CLI_TEST_DEV_VNET_SUBNET_NAME', + random_name_length=24, key=KEY_VNET_SUBNET): + if ' ' in name_prefix: + raise CliTestError( + 'Error: Space character in name prefix \'%s\'' % name_prefix) + super(VnetSubnetPreparer, self).__init__( + name_prefix, random_name_length) + self.cli_ctx = get_dummy_cli() + self.parameter_name = parameter_name + self.key = key + self.resource_group_name = resource_group_name + self.resource_group_key = resource_group_key + self.vnet_name = vnet_name + self.vnet_key = vnet_key + self.address_prefixes = address_prefixes + self.dev_setting_name = os.environ.get(dev_setting_name, None) + + def create_resource(self, name, **kwargs): + if self.dev_setting_name: + return {self.parameter_name: self.dev_setting_name, } + + if not self.resource_group_name: + self.resource_group_name = self.test_class_instance.kwargs.get( + self.resource_group_key) + if not self.resource_group_name: + raise CliTestError("Error: No resource group configured!") + if not self.vnet_name: + self.vnet_name = self.test_class_instance.kwargs.get(self.vnet_key) + if not self.vnet_name: + raise CliTestError("Error: No vnet configured!") + + self.test_class_instance.kwargs[self.key] = 'default' + return {self.parameter_name: name} + + def remove_resource(self, name, **kwargs): + pass diff --git a/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/test_desktopvirtualization_scenario.py b/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/test_desktopvirtualization_scenario.py new file mode 100644 index 00000000000..a07b73396e1 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/tests/latest/test_desktopvirtualization_scenario.py @@ -0,0 +1,267 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft 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 os +import unittest + +from azure_devtools.scenario_tests import AllowLargeResponse +from azure.cli.testsdk import ScenarioTest +from .. import try_manual +from azure.cli.testsdk import ResourceGroupPreparer + + +TEST_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) + + +@try_manual +def setup(test, rg): + pass + + +# EXAMPLE: /HostPools/put/HostPool_Create +@try_manual +def step__hostpools_put_hostpool_create(test, rg): + test.cmd('az desktopvirtualization hostpool create ' + '--location "centralus" ' + '--description "des1" ' + '--friendly-name "friendly" ' + '--host-pool-type "Pooled" ' + '--load-balancer-type "BreadthFirst" ' + '--max-session-limit 999999 ' + '--personal-desktop-assignment-type "Automatic" ' + '--registration-info expiration-time="2020-10-01T14:01:54.9571247Z" registration-token-operation="Update" ' + '' + '--sso-context "KeyVaultPath" ' + '--tags tag1="value1" tag2="value2" ' + '--host-pool-name "{hostPool1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /HostPools/get/HostPool_Get +@try_manual +def step__hostpools_get_hostpool_get(test, rg): + test.cmd('az desktopvirtualization hostpool show ' + '--host-pool-name "{hostPool1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /HostPools/get/HostPool_List +@try_manual +def step__hostpools_get_hostpool_list(test, rg): + test.cmd('az desktopvirtualization hostpool list', + checks=[]) + + +# EXAMPLE: /HostPools/get/HostPool_ListByResourceGroup +@try_manual +def step__hostpools_get_hostpool_listbyresourcegroup(test, rg): + test.cmd('az desktopvirtualization hostpool list ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /HostPools/patch/HostPool_Update +@try_manual +def step__hostpools_patch_hostpool_update(test, rg): + test.cmd('az desktopvirtualization hostpool update ' + '--description "des1" ' + '--friendly-name "friendly" ' + '--load-balancer-type "BreadthFirst" ' + '--max-session-limit 999999 ' + '--personal-desktop-assignment-type "Automatic" ' + '--registration-info expiration-time="2020-10-01T15:01:54.9571247Z" registration-token-operation="Update" ' + '' + '--sso-context "KeyVaultPath" ' + '--tags "{{\\"tag1\\":\\"value1\\",\\"tag2\\":\\"value2\\"}}" ' + '--host-pool-name "{hostPool1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /ApplicationGroups/put/ApplicationGroup_Create +@try_manual +def step__applicationgroups_put_applicationgroup_create(test, rg): + test.cmd('az desktopvirtualization applicationgroup create ' + '--location "centralus" ' + '--description "des1" ' + '--application-group-type "RemoteApp" ' + '--friendly-name "friendly" ' + '--host-pool-arm-path "/subscriptions/{subscription_id}/resourceGroups/{rg}/providers/Microsoft.DesktopVir' + 'tualization/hostPools/{hostPool1}" ' + '--tags tag1="value1" tag2="value2" ' + '--application-group-name "{applicationGroup1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /ApplicationGroups/get/ApplicationGroup_Get +@try_manual +def step__applicationgroups_get_applicationgroup_get(test, rg): + test.cmd('az desktopvirtualization applicationgroup show ' + '--application-group-name "{applicationGroup1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /ApplicationGroups/get/ApplicationGroup_List +@try_manual +def step__applicationgroups_get_applicationgroup_list(test, rg): + test.cmd('az desktopvirtualization applicationgroup list ' + '--filter "applicationGroupType eq \'RailApplication\'"', + checks=[]) + + +# EXAMPLE: /ApplicationGroups/get/ApplicationGroup_ListByResourceGroup +@try_manual +def step__applicationgroups_get_applicationgroup_listbyresourcegroup(test, rg): + test.cmd('az desktopvirtualization applicationgroup list ' + '--filter "applicationGroupType eq \'RailApplication\'" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /ApplicationGroups/patch/ApplicationGroups_Update +@try_manual +def step__applicationgroups_patch_applicationgroups_update(test, rg): + test.cmd('az desktopvirtualization applicationgroup update ' + '--description "des1" ' + '--friendly-name "friendly" ' + '--tags "{{\\"tag1\\":\\"value1\\",\\"tag2\\":\\"value2\\"}}" ' + '--application-group-name "{applicationGroup1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /ApplicationGroups/delete/ApplicationGroup_Delete +@try_manual +def step__applicationgroups_delete_applicationgroup_delete(test, rg): + test.cmd('az desktopvirtualization applicationgroup delete ' + '--application-group-name "{applicationGroup1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /Workspaces/put/Workspace_Create +@try_manual +def step__workspaces_put_workspace_create(test, rg): + test.cmd('az desktopvirtualization workspace create ' + '--resource-group "{rg}" ' + '--location "centralus" ' + '--description "des1" ' + '--friendly-name "friendly" ' + '--tags tag1="value1" tag2="value2" ' + '--workspace-name "{workspace1}"', + checks=[]) + + +# EXAMPLE: /Workspaces/get/Workspace_Get +@try_manual +def step__workspaces_get_workspace_get(test, rg): + test.cmd('az desktopvirtualization workspace show ' + '--resource-group "{rg}" ' + '--workspace-name "{workspace1}"', + checks=[]) + + +# EXAMPLE: /Workspaces/get/Workspace_ListByResourceGroup +@try_manual +def step__workspaces_get_workspace_listbyresourcegroup(test, rg): + test.cmd('az desktopvirtualization workspace list ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /Workspaces/get/Workspace_ListBySubscription +@try_manual +def step__workspaces_get_workspace_listbysubscription(test, rg): + test.cmd('az desktopvirtualization workspace list', + checks=[]) + + +# EXAMPLE: /Workspaces/patch/Workspace_Update +@try_manual +def step__workspaces_patch_workspace_update(test, rg): + test.cmd('az desktopvirtualization workspace update ' + '--resource-group "{rg}" ' + '--description "des1" ' + '--friendly-name "friendly" ' + '--tags "{{\\"tag1\\":\\"value1\\",\\"tag2\\":\\"value2\\"}}" ' + '--workspace-name "{workspace1}"', + checks=[]) + + +# EXAMPLE: /HostPools/delete/HostPool_Delete +@try_manual +def step__hostpools_delete_hostpool_delete(test, rg): + test.cmd('az desktopvirtualization hostpool delete ' + '--force true ' + '--host-pool-name "{hostPool1}" ' + '--resource-group "{rg}"', + checks=[]) + + +# EXAMPLE: /Workspaces/delete/Workspace_Delete +@try_manual +def step__workspaces_delete_workspace_delete(test, rg): + test.cmd('az desktopvirtualization workspace delete ' + '--resource-group "{rg}" ' + '--workspace-name "{workspace1}"', + checks=[]) + + +@try_manual +def cleanup(test, rg): + pass + + +@try_manual +def call_scenario(test, rg): + setup(test, rg) + step__hostpools_put_hostpool_create(test, rg) + step__hostpools_get_hostpool_get(test, rg) + step__hostpools_get_hostpool_list(test, rg) + step__hostpools_get_hostpool_listbyresourcegroup(test, rg) + step__hostpools_patch_hostpool_update(test, rg) + step__applicationgroups_put_applicationgroup_create(test, rg) + step__applicationgroups_get_applicationgroup_get(test, rg) + step__applicationgroups_get_applicationgroup_list(test, rg) + step__applicationgroups_get_applicationgroup_listbyresourcegroup(test, rg) + step__applicationgroups_patch_applicationgroups_update(test, rg) + step__applicationgroups_delete_applicationgroup_delete(test, rg) + step__workspaces_put_workspace_create(test, rg) + step__workspaces_get_workspace_get(test, rg) + step__workspaces_get_workspace_listbyresourcegroup(test, rg) + step__workspaces_get_workspace_listbysubscription(test, rg) + step__workspaces_patch_workspace_update(test, rg) + step__hostpools_delete_hostpool_delete(test, rg) + step__workspaces_delete_workspace_delete(test, rg) + cleanup(test, rg) + + +@try_manual +class DesktopVirtualizationAPIClientScenarioTest(ScenarioTest): + + @ResourceGroupPreparer(name_prefix='clitestdesktopvirtualization_resourceGroup1'[:7], key='rg', + parameter_name='rg') + def test_desktopvirtualization(self, rg): + + self.kwargs.update({ + 'subscription_id': self.get_subscription_id() + }) + + self.kwargs.update({ + 'workspace1': 'workspace1', + 'hostPool1': 'hostPool1', + 'applicationGroup1': 'applicationGroup1', + }) + + call_scenario(self, rg) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/__init__.py new file mode 100644 index 00000000000..ee0c4f36bd0 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/__init__.py @@ -0,0 +1,12 @@ +# 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. +# -------------------------------------------------------------------------- + +__path__ = __import__('pkgutil').extend_path(__path__, __name__) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/__init__.py new file mode 100644 index 00000000000..b7c360c9d94 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/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 + patch_sdk() +except ImportError: + pass diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_configuration.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_configuration.py new file mode 100644 index 00000000000..9028f3cd271 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_configuration.py @@ -0,0 +1,69 @@ +# 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 ._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 = "2019-12-10-preview" + self.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.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/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_desktop_virtualization_api_client.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_desktop_virtualization_api_client.py new file mode 100644 index 00000000000..72e8eb6ee86 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_desktop_virtualization_api_client.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 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 ._configuration import DesktopVirtualizationAPIClientConfiguration +from .operations import OperationOperations +from .operations import WorkspaceOperations +from .operations import ApplicationGroupAssignmentOperations +from .operations import ApplicationGroupOperations +from .operations import StartMenuItemOperations +from .operations import ApplicationOperations +from .operations import DesktopOperations +from .operations import HostPoolOperations +from .operations import UserSessionOperations +from .operations import SessionHostOperations +from .operations import ActiveApplicationOperations +from . import models + + +class DesktopVirtualizationAPIClient(object): + """DesktopVirtualizationAPIClient. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.desktopvirtualization.operations.OperationOperations + :ivar workspace: WorkspaceOperations operations + :vartype workspace: azure.mgmt.desktopvirtualization.operations.WorkspaceOperations + :ivar application_group_assignment: ApplicationGroupAssignmentOperations operations + :vartype application_group_assignment: azure.mgmt.desktopvirtualization.operations.ApplicationGroupAssignmentOperations + :ivar application_group: ApplicationGroupOperations operations + :vartype application_group: azure.mgmt.desktopvirtualization.operations.ApplicationGroupOperations + :ivar start_menu_item: StartMenuItemOperations operations + :vartype start_menu_item: azure.mgmt.desktopvirtualization.operations.StartMenuItemOperations + :ivar application: ApplicationOperations operations + :vartype application: azure.mgmt.desktopvirtualization.operations.ApplicationOperations + :ivar desktop: DesktopOperations operations + :vartype desktop: azure.mgmt.desktopvirtualization.operations.DesktopOperations + :ivar host_pool: HostPoolOperations operations + :vartype host_pool: azure.mgmt.desktopvirtualization.operations.HostPoolOperations + :ivar user_session: UserSessionOperations operations + :vartype user_session: azure.mgmt.desktopvirtualization.operations.UserSessionOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.operations.SessionHostOperations + :ivar active_application: ActiveApplicationOperations operations + :vartype active_application: azure.mgmt.desktopvirtualization.operations.ActiveApplicationOperations + :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._deserialize = Deserializer(client_models) + + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workspace = WorkspaceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_group_assignment = ApplicationGroupAssignmentOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_group = ApplicationGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.start_menu_item = StartMenuItemOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application = ApplicationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.desktop = DesktopOperations( + self._client, self._config, self._serialize, self._deserialize) + self.host_pool = HostPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + self.user_session = UserSessionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.session_host = SessionHostOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_application = ActiveApplicationOperations( + self._client, self._config, self._serialize, self._deserialize) + + 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/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_version.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/_version.py new file mode 100644 index 00000000000..035146e99a2 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/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 = "0.2.0" diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/__init__.py new file mode 100644 index 00000000000..541fe112221 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/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_async import DesktopVirtualizationAPIClient +__all__ = ['DesktopVirtualizationAPIClient'] diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/_configuration_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/_configuration_async.py new file mode 100644 index 00000000000..dd63eb6ad45 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/_configuration_async.py @@ -0,0 +1,65 @@ +# 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 .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + 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_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 = "2019-12-10-preview" + self.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.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/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/_desktop_virtualization_api_client_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/_desktop_virtualization_api_client_async.py new file mode 100644 index 00000000000..63fc9f8915f --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/_desktop_virtualization_api_client_async.py @@ -0,0 +1,108 @@ +# 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 + +from azure.mgmt.core import AsyncARMPipelineClient +from msrest import Deserializer, Serializer + +from ._configuration_async import DesktopVirtualizationAPIClientConfiguration +from .operations_async import OperationOperations +from .operations_async import WorkspaceOperations +from .operations_async import ApplicationGroupAssignmentOperations +from .operations_async import ApplicationGroupOperations +from .operations_async import StartMenuItemOperations +from .operations_async import ApplicationOperations +from .operations_async import DesktopOperations +from .operations_async import HostPoolOperations +from .operations_async import UserSessionOperations +from .operations_async import SessionHostOperations +from .operations_async import ActiveApplicationOperations +from .. import models + + +class DesktopVirtualizationAPIClient(object): + """DesktopVirtualizationAPIClient. + + :ivar operation: OperationOperations operations + :vartype operation: azure.mgmt.desktopvirtualization.aio.operations_async.OperationOperations + :ivar workspace: WorkspaceOperations operations + :vartype workspace: azure.mgmt.desktopvirtualization.aio.operations_async.WorkspaceOperations + :ivar application_group_assignment: ApplicationGroupAssignmentOperations operations + :vartype application_group_assignment: azure.mgmt.desktopvirtualization.aio.operations_async.ApplicationGroupAssignmentOperations + :ivar application_group: ApplicationGroupOperations operations + :vartype application_group: azure.mgmt.desktopvirtualization.aio.operations_async.ApplicationGroupOperations + :ivar start_menu_item: StartMenuItemOperations operations + :vartype start_menu_item: azure.mgmt.desktopvirtualization.aio.operations_async.StartMenuItemOperations + :ivar application: ApplicationOperations operations + :vartype application: azure.mgmt.desktopvirtualization.aio.operations_async.ApplicationOperations + :ivar desktop: DesktopOperations operations + :vartype desktop: azure.mgmt.desktopvirtualization.aio.operations_async.DesktopOperations + :ivar host_pool: HostPoolOperations operations + :vartype host_pool: azure.mgmt.desktopvirtualization.aio.operations_async.HostPoolOperations + :ivar user_session: UserSessionOperations operations + :vartype user_session: azure.mgmt.desktopvirtualization.aio.operations_async.UserSessionOperations + :ivar session_host: SessionHostOperations operations + :vartype session_host: azure.mgmt.desktopvirtualization.aio.operations_async.SessionHostOperations + :ivar active_application: ActiveApplicationOperations operations + :vartype active_application: azure.mgmt.desktopvirtualization.aio.operations_async.ActiveApplicationOperations + :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._deserialize = Deserializer(client_models) + + self.operation = OperationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.workspace = WorkspaceOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_group_assignment = ApplicationGroupAssignmentOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_group = ApplicationGroupOperations( + self._client, self._config, self._serialize, self._deserialize) + self.start_menu_item = StartMenuItemOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application = ApplicationOperations( + self._client, self._config, self._serialize, self._deserialize) + self.desktop = DesktopOperations( + self._client, self._config, self._serialize, self._deserialize) + self.host_pool = HostPoolOperations( + self._client, self._config, self._serialize, self._deserialize) + self.user_session = UserSessionOperations( + self._client, self._config, self._serialize, self._deserialize) + self.session_host = SessionHostOperations( + self._client, self._config, self._serialize, self._deserialize) + self.active_application = ActiveApplicationOperations( + self._client, self._config, self._serialize, self._deserialize) + + 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/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/__init__.py new file mode 100644 index 00000000000..8168693886f --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operation_operations_async import OperationOperations +from ._workspace_operations_async import WorkspaceOperations +from ._application_group_assignment_operations_async import ApplicationGroupAssignmentOperations +from ._application_group_operations_async import ApplicationGroupOperations +from ._start_menu_item_operations_async import StartMenuItemOperations +from ._application_operations_async import ApplicationOperations +from ._desktop_operations_async import DesktopOperations +from ._host_pool_operations_async import HostPoolOperations +from ._user_session_operations_async import UserSessionOperations +from ._session_host_operations_async import SessionHostOperations +from ._active_application_operations_async import ActiveApplicationOperations + +__all__ = [ + 'OperationOperations', + 'WorkspaceOperations', + 'ApplicationGroupAssignmentOperations', + 'ApplicationGroupOperations', + 'StartMenuItemOperations', + 'ApplicationOperations', + 'DesktopOperations', + 'HostPoolOperations', + 'UserSessionOperations', + 'SessionHostOperations', + 'ActiveApplicationOperations', +] diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_active_application_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_active_application_operations_async.py new file mode 100644 index 00000000000..bad6d976256 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_active_application_operations_async.py @@ -0,0 +1,122 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ActiveApplicationOperations: + """ActiveApplicationOperations 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: ~azure.mgmt.desktopvirtualization.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_session_host( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + filter: Optional[str] = None, + **kwargs + ) -> "models.ApplicationList": + """List applications for the given 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 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: ApplicationList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_session_host.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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_by_session_host.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/activeApplications'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_group_assignment_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_group_assignment_operations_async.py new file mode 100644 index 00000000000..2632a6ebcdc --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_group_assignment_operations_async.py @@ -0,0 +1,118 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationGroupAssignmentOperations: + """ApplicationGroupAssignmentOperations 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: ~azure.mgmt.desktopvirtualization.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 workspace_level_list( + self, + resource_group_name: str, + workspace_name: str, + filter: Optional[str] = None, + **kwargs + ) -> "models.ApplicationGroupList": + """List application group that user can use. + + :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 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: ApplicationGroupList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroupList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.workspace_level_list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 + ) + workspace_level_list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/userApplicationGroupAssignments'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_group_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_group_operations_async.py new file mode 100644 index 00000000000..e124548b757 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_group_operations_async.py @@ -0,0 +1,449 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationGroupOperations: + """ApplicationGroupOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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}'} + + async def create_or_update( + self, + resource_group_name: str, + application_group_name: str, + location: str, + host_pool_arm_path: str, + application_group_type: Union[str, "models.ApplicationGroupType"], + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ) -> "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 location: The geo-location where the resource lives. + :type location: str + :param host_pool_arm_path: HostPool arm path of ApplicationGroup. + :type host_pool_arm_path: str + :param application_group_type: Resource Type of ApplicationGroup. + :type application_group_type: str or ~azure.mgmt.desktopvirtualization.models.ApplicationGroupType + :param tags: Resource tags. + :type tags: dict[str, str] + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_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: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or ~azure.mgmt.desktopvirtualization.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application_group = models.ApplicationGroup(tags=tags, location=location, description=description, friendly_name=friendly_name, host_pool_arm_path=host_pool_arm_path, application_group_type=application_group_type) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def delete( + self, + resource_group_name: str, + application_group_name: str, + **kwargs + ) -> 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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] + + # Construct and send request + 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}'} + + async def update( + self, + resource_group_name: str, + application_group_name: str, + tags: Optional[object] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ) -> "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 tags: tags to be updated. + :type tags: object + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_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: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application_group = models.ApplicationGroupPatch(tags=tags, description=description, friendly_name=friendly_name) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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}'} + + def list_by_resource_group( + self, + resource_group_name: str, + filter: Optional[str] = None, + **kwargs + ) -> "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: ApplicationGroupList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroupList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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'} + + def list_by_subscription( + self, + filter: Optional[str] = None, + **kwargs + ) -> "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: ApplicationGroupList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroupList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_operations_async.py new file mode 100644 index 00000000000..fc09d7f9819 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_application_operations_async.py @@ -0,0 +1,425 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationOperations: + """ApplicationOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: ~azure.mgmt.desktopvirtualization.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + async def create_or_update( + self, + resource_group_name: str, + application_group_name: str, + application_name: str, + command_line_setting: Union[str, "models.CommandLineSetting"], + description: Optional[str] = None, + friendly_name: Optional[str] = None, + file_path: Optional[str] = None, + command_line_arguments: Optional[str] = None, + show_in_portal: Optional[bool] = None, + icon_path: Optional[str] = None, + icon_index: Optional[int] = None, + **kwargs + ) -> "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 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. + :type command_line_setting: str or ~azure.mgmt.desktopvirtualization.models.CommandLineSetting + :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_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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.Application or ~azure.mgmt.desktopvirtualization.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application = models.Application(description=description, friendly_name=friendly_name, file_path=file_path, command_line_setting=command_line_setting, command_line_arguments=command_line_arguments, show_in_portal=show_in_portal, icon_path=icon_path, icon_index=icon_index) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def delete( + self, + resource_group_name: str, + application_group_name: str, + application_name: str, + **kwargs + ) -> 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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] + + # Construct and send request + 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}'} + + async def update( + self, + resource_group_name: str, + application_group_name: str, + application_name: str, + tags: Optional[object] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + file_path: Optional[str] = None, + command_line_setting: Optional[Union[str, "models.CommandLineSetting"]] = None, + command_line_arguments: Optional[str] = None, + show_in_portal: Optional[bool] = None, + icon_path: Optional[str] = None, + icon_index: Optional[int] = None, + **kwargs + ) -> "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 tags: tags to be updated. + :type tags: object + :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. + :type command_line_setting: str or ~azure.mgmt.desktopvirtualization.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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application = models.ApplicationPatch(tags=tags, description=description, friendly_name=friendly_name, file_path=file_path, command_line_setting=command_line_setting, command_line_arguments=command_line_arguments, show_in_portal=show_in_portal, icon_path=icon_path, icon_index=icon_index) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + def list( + self, + resource_group_name: str, + application_group_name: str, + **kwargs + ) -> "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: ApplicationList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_desktop_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_desktop_operations_async.py new file mode 100644 index 00000000000..4fda09d4f66 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_desktop_operations_async.py @@ -0,0 +1,234 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DesktopOperations: + """DesktopOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: ~azure.mgmt.desktopvirtualization.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Desktop"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + async def update( + self, + resource_group_name: str, + application_group_name: str, + desktop_name: str, + tags: Optional[object] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ) -> "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 tags: tags to be updated. + :type tags: object + :param description: Description of Desktop. + :type description: str + :param friendly_name: Friendly name of Desktop. + :type friendly_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: ~azure.mgmt.desktopvirtualization.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Desktop"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _desktop = models.DesktopPatch(tags=tags, description=description, friendly_name=friendly_name) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + async def list( + self, + resource_group_name: str, + application_group_name: str, + **kwargs + ) -> "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: DesktopList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.DesktopList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DesktopList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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('DesktopList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_host_pool_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_host_pool_operations_async.py new file mode 100644 index 00000000000..ddc48568363 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_host_pool_operations_async.py @@ -0,0 +1,490 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class HostPoolOperations: + """HostPoolOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: ~azure.mgmt.desktopvirtualization.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPool"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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'] = 'application/json' + + # Construct and send request + 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}'} + + async def create_or_update( + self, + resource_group_name: str, + host_pool_name: str, + location: str, + host_pool_type: Union[str, "models.HostPoolType"], + personal_desktop_assignment_type: Union[str, "models.PersonalDesktopAssignmentType"], + load_balancer_type: Union[str, "models.LoadBalancerType"], + 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, + ring: Optional[int] = None, + validation_environment: Optional[bool] = None, + registration_info: Optional["models.RegistrationInfo"] = None, + vm_template: Optional[str] = None, + sso_context: Optional[str] = None, + **kwargs + ) -> "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 location: The geo-location where the resource lives. + :type location: str + :param host_pool_type: HostPool type for desktop. + :type host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.HostPoolType + :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. + :type personal_desktop_assignment_type: str or ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. + :type load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType + :param tags: Resource tags. + :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 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: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo + :param vm_template: VM template for sessionhosts configuration within hostpool. + :type vm_template: str + :param sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: 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: ~azure.mgmt.desktopvirtualization.models.HostPool or ~azure.mgmt.desktopvirtualization.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPool"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _host_pool = models.HostPool(tags=tags, location=location, friendly_name=friendly_name, description=description, host_pool_type=host_pool_type, personal_desktop_assignment_type=personal_desktop_assignment_type, custom_rdp_property=custom_rdp_property, max_session_limit=max_session_limit, load_balancer_type=load_balancer_type, ring=ring, validation_environment=validation_environment, registration_info=registration_info, vm_template=vm_template, sso_context=sso_context) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def delete( + self, + resource_group_name: str, + host_pool_name: str, + force: Optional[bool] = None, + **kwargs + ) -> 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + 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}'} + + async def update( + self, + resource_group_name: str, + host_pool_name: str, + tags: Optional[object] = 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, "models.PersonalDesktopAssignmentType"]] = None, + load_balancer_type: Optional[Union[str, "models.LoadBalancerType"]] = None, + ring: Optional[int] = None, + validation_environment: Optional[bool] = None, + registration_info: Optional["models.RegistrationInfoPatch"] = None, + sso_context: Optional[str] = None, + **kwargs + ) -> "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 tags: tags to be updated. + :type tags: object + :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. + :type personal_desktop_assignment_type: str or ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. + :type load_balancer_type: str or ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch + :param sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: 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: ~azure.mgmt.desktopvirtualization.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPool"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _host_pool = models.HostPoolPatch(tags=tags, friendly_name=friendly_name, description=description, custom_rdp_property=custom_rdp_property, max_session_limit=max_session_limit, personal_desktop_assignment_type=personal_desktop_assignment_type, load_balancer_type=load_balancer_type, ring=ring, validation_environment=validation_environment, registration_info=registration_info, sso_context=sso_context) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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'] = 'application/json' + + # Construct and send request + 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}'} + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> "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: HostPoolList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPoolList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPoolList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} + + def list( + self, + **kwargs + ) -> "models.HostPoolList": + """List hostPools in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPoolList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPoolList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPoolList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_operation_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_operation_operations_async.py new file mode 100644 index 00000000000..22e3d5d2ff4 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_operation_operations_async.py @@ -0,0 +1,84 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations: + """OperationOperations 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: ~azure.mgmt.desktopvirtualization.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 list( + self, + **kwargs + ) -> "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: ResourceProviderOperationList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProviderOperationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.list.metadata['url'] + + # 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'] = 'application/json' + + # Construct and send request + 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('ResourceProviderOperationList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DesktopVirtualization/operations'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_session_host_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_session_host_operations_async.py new file mode 100644 index 00000000000..2bfa4ed09c8 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_session_host_operations_async.py @@ -0,0 +1,307 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class SessionHostOperations: + """SessionHostOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: ~azure.mgmt.desktopvirtualization.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SessionHost"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + async def delete( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + force: Optional[bool] = None, + **kwargs + ) -> 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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] + + # Construct and send request + 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}'} + + async def update( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + allow_new_session: Optional[bool] = None, + assigned_user: Optional[str] = None, + **kwargs + ) -> "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 allow_new_session: Allow a new session. + :type allow_new_session: bool + :param assigned_user: User assigned to SessionHost. + :type assigned_user: 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: ~azure.mgmt.desktopvirtualization.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SessionHost"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _session_host = models.SessionHostPatch(allow_new_session=allow_new_session, assigned_user=assigned_user) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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}'} + + def list( + self, + resource_group_name: str, + host_pool_name: str, + **kwargs + ) -> "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: SessionHostList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SessionHostList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_start_menu_item_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_start_menu_item_operations_async.py new file mode 100644 index 00000000000..9bca5ed22bc --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_start_menu_item_operations_async.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class StartMenuItemOperations: + """StartMenuItemOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: StartMenuItemList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.StartMenuItemList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StartMenuItemList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_user_session_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_user_session_operations_async.py new file mode 100644 index 00000000000..eff69082501 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_user_session_operations_async.py @@ -0,0 +1,454 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class UserSessionOperations: + """UserSessionOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: UserSessionList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.UserSessionList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserSessionList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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'} + + async def get( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs + ) -> "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: ~azure.mgmt.desktopvirtualization.models.UserSession + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserSession"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + 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 + ) -> 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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] + + # Construct and send request + 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}'} + + def list( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + **kwargs + ) -> "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: UserSessionList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.UserSessionList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserSessionList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} + + async def disconnect( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + **kwargs + ) -> 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.disconnect.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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] + + # Construct and send request + 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'} + + async def send_message( + self, + resource_group_name: str, + host_pool_name: str, + session_host_name: str, + user_session_id: str, + message_title: Optional[str] = None, + message_body: Optional[str] = None, + **kwargs + ) -> 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 message_title: Title of message. + :type message_title: str + :param message_body: Body of message. + :type message_body: 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _send_message = models.SendMessage(message_title=message_title, message_body=message_body) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.send_message.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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') + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_workspace_operations_async.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_workspace_operations_async.py new file mode 100644 index 00000000000..a6712a8649e --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/aio/operations_async/_workspace_operations_async.py @@ -0,0 +1,437 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import 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 + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceOperations: + """WorkspaceOperations 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: ~azure.mgmt.desktopvirtualization.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 + ) -> "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: ~azure.mgmt.desktopvirtualization.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workspace"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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'] = 'application/json' + + # Construct and send request + 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}'} + + async def create_or_update( + self, + resource_group_name: str, + workspace_name: str, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + application_group_references: Optional[List[str]] = None, + **kwargs + ) -> "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 location: The geo-location where the resource lives. + :type location: str + :param tags: Resource tags. + :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 resource Ids. + :type application_group_references: list[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: ~azure.mgmt.desktopvirtualization.models.Workspace or ~azure.mgmt.desktopvirtualization.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workspace"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _workspace = models.Workspace(tags=tags, location=location, description=description, friendly_name=friendly_name, application_group_references=application_group_references) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + async def delete( + self, + resource_group_name: str, + workspace_name: str, + **kwargs + ) -> 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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] + + # Construct and send request + 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}'} + + async def update( + self, + resource_group_name: str, + workspace_name: str, + tags: Optional[object] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + application_group_references: Optional[List[str]] = None, + **kwargs + ) -> "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 tags: tags to be updated. + :type tags: object + :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] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workspace"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _workspace = models.WorkspacePatch(tags=tags, description=description, friendly_name=friendly_name, application_group_references=application_group_references) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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'] = 'application/json' + + # Construct and send request + 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}'} + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> "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: WorkspaceList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.WorkspaceList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkspaceList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} + + def list_by_subscription( + self, + **kwargs + ) -> "models.WorkspaceList": + """List workspaces in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.WorkspaceList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkspaceList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/__init__.py new file mode 100644 index 00000000000..b642bd2d7f5 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/__init__.py @@ -0,0 +1,126 @@ +# 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 Desktop + from ._models_py3 import DesktopList + from ._models_py3 import DesktopPatch + from ._models_py3 import HostPool + from ._models_py3 import HostPoolList + from ._models_py3 import HostPoolPatch + from ._models_py3 import RegistrationInfo + from ._models_py3 import RegistrationInfoPatch + from ._models_py3 import Resource + from ._models_py3 import ResourceProviderOperation + from ._models_py3 import ResourceProviderOperationDisplay + from ._models_py3 import ResourceProviderOperationList + from ._models_py3 import SendMessage + from ._models_py3 import SessionHost + from ._models_py3 import SessionHostList + from ._models_py3 import SessionHostPatch + from ._models_py3 import StartMenuItem + from ._models_py3 import StartMenuItemList + from ._models_py3 import TrackedResource + 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 Desktop # type: ignore + from ._models import DesktopList # type: ignore + from ._models import DesktopPatch # type: ignore + from ._models import HostPool # type: ignore + from ._models import HostPoolList # type: ignore + from ._models import HostPoolPatch # type: ignore + from ._models import RegistrationInfo # type: ignore + from ._models import RegistrationInfoPatch # type: ignore + from ._models import Resource # type: ignore + from ._models import ResourceProviderOperation # type: ignore + from ._models import ResourceProviderOperationDisplay # type: ignore + from ._models import ResourceProviderOperationList # type: ignore + from ._models import SendMessage # type: ignore + from ._models import SessionHost # type: ignore + from ._models import SessionHostList # type: ignore + from ._models import SessionHostPatch # type: ignore + from ._models import StartMenuItem # type: ignore + from ._models import StartMenuItemList # type: ignore + from ._models import TrackedResource # 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, + HostPoolType, + LoadBalancerType, + PersonalDesktopAssignmentType, + RegistrationTokenOperation, + SessionState, + Status, + UpdateState, +) + +__all__ = [ + 'Application', + 'ApplicationGroup', + 'ApplicationGroupList', + 'ApplicationGroupPatch', + 'ApplicationList', + 'ApplicationPatch', + 'Desktop', + 'DesktopList', + 'DesktopPatch', + 'HostPool', + 'HostPoolList', + 'HostPoolPatch', + 'RegistrationInfo', + 'RegistrationInfoPatch', + 'Resource', + 'ResourceProviderOperation', + 'ResourceProviderOperationDisplay', + 'ResourceProviderOperationList', + 'SendMessage', + 'SessionHost', + 'SessionHostList', + 'SessionHostPatch', + 'StartMenuItem', + 'StartMenuItemList', + 'TrackedResource', + 'UserSession', + 'UserSessionList', + 'Workspace', + 'WorkspaceList', + 'WorkspacePatch', + 'ApplicationGroupType', + 'ApplicationType', + 'CommandLineSetting', + 'HostPoolType', + 'LoadBalancerType', + 'PersonalDesktopAssignmentType', + 'RegistrationTokenOperation', + 'SessionState', + 'Status', + 'UpdateState', +] diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py new file mode 100644 index 00000000000..f087ff99f72 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_desktop_virtualization_api_client_enums.py @@ -0,0 +1,95 @@ +# 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 + +class ApplicationGroupType(str, Enum): + """Resource Type of ApplicationGroup. + """ + + remote_app = "RemoteApp" + desktop = "Desktop" + +class ApplicationType(str, Enum): + """Application type of application. + """ + + remote_app = "RemoteApp" + desktop = "Desktop" + +class CommandLineSetting(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 HostPoolType(str, Enum): + """HostPool type for desktop. + """ + + personal = "Personal" + pooled = "Pooled" + +class LoadBalancerType(str, Enum): + """The type of the load balancer. + """ + + breadth_first = "BreadthFirst" + depth_first = "DepthFirst" + persistent = "Persistent" + +class PersonalDesktopAssignmentType(str, Enum): + """PersonalDesktopAssignment type for HostPool. + """ + + automatic = "Automatic" + direct = "Direct" + +class RegistrationTokenOperation(str, Enum): + """The type of resetting the token. + """ + + delete = "Delete" + none = "None" + update = "Update" + +class SessionState(str, Enum): + """State of user session. + """ + + unknown = "Unknown" + active = "Active" + disconnected = "Disconnected" + pending = "Pending" + log_off = "LogOff" + user_profile_disk_mounted = "UserProfileDiskMounted" + +class Status(str, Enum): + """Status for a SessionHost. + """ + + available = "Available" + unavailable = "Unavailable" + shutdown = "Shutdown" + disconnected = "Disconnected" + upgrading = "Upgrading" + upgrade_failed = "UpgradeFailed" + +class UpdateState(str, Enum): + """Update state of a SessionHost. + """ + + initial = "Initial" + pending = "Pending" + started = "Started" + succeeded = "Succeeded" + failed = "Failed" diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_models.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_models.py new file mode 100644 index 00000000000..5218869cb90 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_models.py @@ -0,0 +1,1316 @@ +# 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): + """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. Ex- 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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: 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 ~azure.mgmt.desktopvirtualization.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}, + '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'}, + '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'}, + 'icon_hash': {'key': 'properties.iconHash', 'type': 'str'}, + 'icon_content': {'key': 'properties.iconContent', 'type': 'bytearray'}, + } + + def __init__( + self, + **kwargs + ): + super(Application, self).__init__(**kwargs) + 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['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 TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + self.location = kwargs['location'] + + +class ApplicationGroup(TrackedResource): + """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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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 + ~azure.mgmt.desktopvirtualization.models.ApplicationGroupType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'host_pool_arm_path': {'required': True}, + 'workspace_arm_path': {'readonly': True}, + 'application_group_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', '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'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationGroup, self).__init__(**kwargs) + 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'] + + +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[~azure.mgmt.desktopvirtualization.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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: object + :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': 'object'}, + '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[~azure.mgmt.desktopvirtualization.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: object + :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 ~azure.mgmt.desktopvirtualization.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 + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + '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'}, + } + + 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) + + +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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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}, + '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'}, + '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.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[~azure.mgmt.desktopvirtualization.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: object + :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': 'object'}, + '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 HostPool(TrackedResource): + """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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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". + :type host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.HostPoolType + :param personal_desktop_assignment_type: Required. PersonalDesktopAssignment type for HostPool. + Possible values include: "Automatic", "Direct". + :type personal_desktop_assignment_type: str or + ~azure.mgmt.desktopvirtualization.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 ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.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 sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'host_pool_type': {'required': True}, + 'personal_desktop_assignment_type': {'required': True}, + 'load_balancer_type': {'required': True}, + 'application_group_references': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', '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]'}, + 'sso_context': {'key': 'properties.ssoContext', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(HostPool, self).__init__(**kwargs) + 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['personal_desktop_assignment_type'] + 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.sso_context = kwargs.get('sso_context', 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[~azure.mgmt.desktopvirtualization.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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: object + :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 + ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :type load_balancer_type: str or ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch + :param sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: 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': 'object'}, + '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'}, + 'sso_context': {'key': 'properties.ssoContext', '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.sso_context = kwargs.get('sso_context', 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 + ~azure.mgmt.desktopvirtualization.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 + ~azure.mgmt.desktopvirtualization.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 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: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.display = kwargs.get('display', 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. + + :param value: List of operations supported by this resource provider. + :type value: list[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + } + + def __init__( + self, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = kwargs.get('value', 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 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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 + :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". + :type status: str or ~azure.mgmt.desktopvirtualization.models.Status + :ivar status_timestamp: The timestamp of the status. + :vartype status_timestamp: ~datetime.datetime + :param os_version: The version of the OS on the session host. + :type os_version: str + :param sx_s_stack_version: The version of the side by side stack on the session host. + :type sx_s_stack_version: str + :param update_state: Update state of a SessionHost. Possible values include: "Initial", + "Pending", "Started", "Succeeded", "Failed". + :type update_state: str or ~azure.mgmt.desktopvirtualization.models.UpdateState + :ivar last_update_time: The timestamp of the last update. + :vartype last_update_time: ~datetime.datetime + :param update_error_message: The error message. + :type update_error_message: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status_timestamp': {'readonly': True}, + 'last_update_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', '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'}, + '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'}, + } + + def __init__( + self, + **kwargs + ): + super(SessionHost, self).__init__(**kwargs) + 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.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) + + +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[~azure.mgmt.desktopvirtualization.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. Ex- 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param app_alias: Alias of StartMenuItem. + :type app_alias: str + :param friendly_name: Friendly name of StartMenuItem. + :type friendly_name: 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'}, + 'friendly_name': {'key': 'properties.friendlyName', '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.friendly_name = kwargs.get('friendly_name', 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[~azure.mgmt.desktopvirtualization.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 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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 ~azure.mgmt.desktopvirtualization.models.ApplicationType + :param session_state: State of user session. Possible values include: "Unknown", "Active", + "Disconnected", "Pending", "LogOff", "UserProfileDiskMounted". + :type session_state: str or ~azure.mgmt.desktopvirtualization.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}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', '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.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[~azure.mgmt.desktopvirtualization.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(TrackedResource): + """Represents a Workspace 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(Workspace, self).__init__(**kwargs) + self.description = kwargs.get('description', None) + self.friendly_name = kwargs.get('friendly_name', None) + self.application_group_references = kwargs.get('application_group_references', 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[~azure.mgmt.desktopvirtualization.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: object + :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] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', '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) diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_models_py3.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_models_py3.py new file mode 100644 index 00000000000..5067fa66cd5 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/models/_models_py3.py @@ -0,0 +1,1460 @@ +# 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 + + +class Resource(msrest.serialization.Model): + """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. Ex- 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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: 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 ~azure.mgmt.desktopvirtualization.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}, + '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'}, + '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'}, + '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, + 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.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.icon_hash = None + self.icon_content = None + + +class TrackedResource(Resource): + """The resource model definition for a ARM tracked top level resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class ApplicationGroup(TrackedResource): + """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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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 + ~azure.mgmt.desktopvirtualization.models.ApplicationGroupType + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'host_pool_arm_path': {'required': True}, + 'workspace_arm_path': {'readonly': True}, + 'application_group_type': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', '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'}, + } + + def __init__( + self, + *, + location: str, + host_pool_arm_path: str, + application_group_type: Union[str, "ApplicationGroupType"], + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + **kwargs + ): + super(ApplicationGroup, self).__init__(tags=tags, location=location, **kwargs) + 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 + + +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[~azure.mgmt.desktopvirtualization.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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: object + :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': 'object'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[object] = 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[~azure.mgmt.desktopvirtualization.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: object + :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 ~azure.mgmt.desktopvirtualization.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 + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + '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'}, + } + + def __init__( + self, + *, + tags: Optional[object] = 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, + **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 + + +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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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}, + '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'}, + '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.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[~azure.mgmt.desktopvirtualization.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: object + :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': 'object'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[object] = 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 HostPool(TrackedResource): + """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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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". + :type host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.HostPoolType + :param personal_desktop_assignment_type: Required. PersonalDesktopAssignment type for HostPool. + Possible values include: "Automatic", "Direct". + :type personal_desktop_assignment_type: str or + ~azure.mgmt.desktopvirtualization.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 ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.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 sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'host_pool_type': {'required': True}, + 'personal_desktop_assignment_type': {'required': True}, + 'load_balancer_type': {'required': True}, + 'application_group_references': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', '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]'}, + 'sso_context': {'key': 'properties.ssoContext', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + host_pool_type: Union[str, "HostPoolType"], + personal_desktop_assignment_type: Union[str, "PersonalDesktopAssignmentType"], + load_balancer_type: Union[str, "LoadBalancerType"], + 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, + ring: Optional[int] = None, + validation_environment: Optional[bool] = None, + registration_info: Optional["RegistrationInfo"] = None, + vm_template: Optional[str] = None, + sso_context: Optional[str] = None, + **kwargs + ): + super(HostPool, self).__init__(tags=tags, location=location, **kwargs) + 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.sso_context = sso_context + + +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[~azure.mgmt.desktopvirtualization.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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. tags to be updated. + :type tags: object + :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 + ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. Possible values include: + "BreadthFirst", "DepthFirst", "Persistent". + :type load_balancer_type: str or ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch + :param sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: 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': 'object'}, + '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'}, + 'sso_context': {'key': 'properties.ssoContext', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[object] = 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, + sso_context: Optional[str] = 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.sso_context = sso_context + + +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 + ~azure.mgmt.desktopvirtualization.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 + ~azure.mgmt.desktopvirtualization.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 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: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationDisplay + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'display': {'key': 'display', 'type': 'ResourceProviderOperationDisplay'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + display: Optional["ResourceProviderOperationDisplay"] = None, + **kwargs + ): + super(ResourceProviderOperation, self).__init__(**kwargs) + self.name = name + self.display = display + + +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. + + :param value: List of operations supported by this resource provider. + :type value: list[~azure.mgmt.desktopvirtualization.models.ResourceProviderOperation] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ResourceProviderOperation]'}, + } + + def __init__( + self, + *, + value: Optional[List["ResourceProviderOperation"]] = None, + **kwargs + ): + super(ResourceProviderOperationList, self).__init__(**kwargs) + self.value = value + + +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 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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 + :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". + :type status: str or ~azure.mgmt.desktopvirtualization.models.Status + :ivar status_timestamp: The timestamp of the status. + :vartype status_timestamp: ~datetime.datetime + :param os_version: The version of the OS on the session host. + :type os_version: str + :param sx_s_stack_version: The version of the side by side stack on the session host. + :type sx_s_stack_version: str + :param update_state: Update state of a SessionHost. Possible values include: "Initial", + "Pending", "Started", "Succeeded", "Failed". + :type update_state: str or ~azure.mgmt.desktopvirtualization.models.UpdateState + :ivar last_update_time: The timestamp of the last update. + :vartype last_update_time: ~datetime.datetime + :param update_error_message: The error message. + :type update_error_message: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'status_timestamp': {'readonly': True}, + 'last_update_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', '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'}, + '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'}, + } + + 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.last_heart_beat = last_heart_beat + self.sessions = sessions + self.agent_version = agent_version + self.allow_new_session = allow_new_session + 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 + + +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[~azure.mgmt.desktopvirtualization.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. Ex- 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param app_alias: Alias of StartMenuItem. + :type app_alias: str + :param friendly_name: Friendly name of StartMenuItem. + :type friendly_name: 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'}, + 'friendly_name': {'key': 'properties.friendlyName', '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, + friendly_name: 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.friendly_name = friendly_name + 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[~azure.mgmt.desktopvirtualization.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 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: 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 ~azure.mgmt.desktopvirtualization.models.ApplicationType + :param session_state: State of user session. Possible values include: "Unknown", "Active", + "Disconnected", "Pending", "LogOff", "UserProfileDiskMounted". + :type session_state: str or ~azure.mgmt.desktopvirtualization.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}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', '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.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[~azure.mgmt.desktopvirtualization.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(TrackedResource): + """Represents a Workspace 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. Ex- Microsoft.Compute/virtualMachines or + Microsoft.Storage/storageAccounts. + :vartype type: str + :param tags: A set of tags. Resource tags. + :type tags: dict[str, str] + :param location: Required. The geo-location where the resource lives. + :type location: 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] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + application_group_references: Optional[List[str]] = None, + **kwargs + ): + super(Workspace, self).__init__(tags=tags, location=location, **kwargs) + self.description = description + self.friendly_name = friendly_name + self.application_group_references = application_group_references + + +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[~azure.mgmt.desktopvirtualization.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: object + :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] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': 'object'}, + 'description': {'key': 'properties.description', 'type': 'str'}, + 'friendly_name': {'key': 'properties.friendlyName', 'type': 'str'}, + 'application_group_references': {'key': 'properties.applicationGroupReferences', 'type': '[str]'}, + } + + def __init__( + self, + *, + tags: Optional[object] = None, + description: Optional[str] = None, + friendly_name: Optional[str] = None, + application_group_references: Optional[List[str]] = 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 diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/__init__.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/__init__.py new file mode 100644 index 00000000000..08f1a117a4f --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._operation_operations import OperationOperations +from ._workspace_operations import WorkspaceOperations +from ._application_group_assignment_operations import ApplicationGroupAssignmentOperations +from ._application_group_operations import ApplicationGroupOperations +from ._start_menu_item_operations import StartMenuItemOperations +from ._application_operations import ApplicationOperations +from ._desktop_operations import DesktopOperations +from ._host_pool_operations import HostPoolOperations +from ._user_session_operations import UserSessionOperations +from ._session_host_operations import SessionHostOperations +from ._active_application_operations import ActiveApplicationOperations + +__all__ = [ + 'OperationOperations', + 'WorkspaceOperations', + 'ApplicationGroupAssignmentOperations', + 'ApplicationGroupOperations', + 'StartMenuItemOperations', + 'ApplicationOperations', + 'DesktopOperations', + 'HostPoolOperations', + 'UserSessionOperations', + 'SessionHostOperations', + 'ActiveApplicationOperations', +] diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_active_application_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_active_application_operations.py new file mode 100644 index 00000000000..2603ce46131 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_active_application_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 TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ActiveApplicationOperations(object): + """ActiveApplicationOperations 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: ~azure.mgmt.desktopvirtualization.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_session_host( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ApplicationList" + """List applications for the given 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 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: ApplicationList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_session_host.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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_by_session_host.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/hostPools/{hostPoolName}/sessionHosts/{sessionHostName}/activeApplications'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_group_assignment_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_group_assignment_operations.py new file mode 100644 index 00000000000..6ecb0171545 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_group_assignment_operations.py @@ -0,0 +1,123 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationGroupAssignmentOperations(object): + """ApplicationGroupAssignmentOperations 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: ~azure.mgmt.desktopvirtualization.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 workspace_level_list( + self, + resource_group_name, # type: str + workspace_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "models.ApplicationGroupList" + """List application group that user can use. + + :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 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: ApplicationGroupList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroupList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.workspace_level_list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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 + ) + workspace_level_list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/workspaces/{workspaceName}/userApplicationGroupAssignments'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_group_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_group_operations.py new file mode 100644 index 00000000000..b5039e2eafc --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_group_operations.py @@ -0,0 +1,459 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationGroupOperations(object): + """ApplicationGroupOperations 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: ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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}'} + + def create_or_update( + self, + resource_group_name, # type: str + application_group_name, # type: str + location, # type: str + host_pool_arm_path, # type: str + application_group_type, # type: Union[str, "models.ApplicationGroupType"] + tags=None, # type: Optional[Dict[str, str]] + description=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + **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 location: The geo-location where the resource lives. + :type location: str + :param host_pool_arm_path: HostPool arm path of ApplicationGroup. + :type host_pool_arm_path: str + :param application_group_type: Resource Type of ApplicationGroup. + :type application_group_type: str or ~azure.mgmt.desktopvirtualization.models.ApplicationGroupType + :param tags: Resource tags. + :type tags: dict[str, str] + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_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: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup or ~azure.mgmt.desktopvirtualization.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application_group = models.ApplicationGroup(tags=tags, location=location, description=description, friendly_name=friendly_name, host_pool_arm_path=host_pool_arm_path, application_group_type=application_group_type) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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] + + # Construct and send request + 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}'} + + def update( + self, + resource_group_name, # type: str + application_group_name, # type: str + tags=None, # type: Optional[object] + description=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + **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 tags: tags to be updated. + :type tags: object + :param description: Description of ApplicationGroup. + :type description: str + :param friendly_name: Friendly name of ApplicationGroup. + :type friendly_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: ~azure.mgmt.desktopvirtualization.models.ApplicationGroup + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroup"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application_group = models.ApplicationGroupPatch(tags=tags, description=description, friendly_name=friendly_name) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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}'} + + def list_by_resource_group( + self, + resource_group_name, # type: str + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "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: ApplicationGroupList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroupList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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'} + + def list_by_subscription( + self, + filter=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> "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: ApplicationGroupList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationGroupList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationGroupList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + 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) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_operations.py new file mode 100644 index 00000000000..866ab4dbdda --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_application_operations.py @@ -0,0 +1,434 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ApplicationOperations(object): + """ApplicationOperations 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: ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + def create_or_update( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_name, # type: str + command_line_setting, # type: Union[str, "models.CommandLineSetting"] + description=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + file_path=None, # type: Optional[str] + command_line_arguments=None, # type: Optional[str] + show_in_portal=None, # type: Optional[bool] + icon_path=None, # type: Optional[str] + icon_index=None, # type: Optional[int] + **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 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. + :type command_line_setting: str or ~azure.mgmt.desktopvirtualization.models.CommandLineSetting + :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_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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.Application or ~azure.mgmt.desktopvirtualization.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application = models.Application(description=description, friendly_name=friendly_name, file_path=file_path, command_line_setting=command_line_setting, command_line_arguments=command_line_arguments, show_in_portal=show_in_portal, icon_path=icon_path, icon_index=icon_index) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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] + + # Construct and send request + 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}'} + + def update( + self, + resource_group_name, # type: str + application_group_name, # type: str + application_name, # type: str + tags=None, # type: Optional[object] + description=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + file_path=None, # type: Optional[str] + command_line_setting=None, # type: Optional[Union[str, "models.CommandLineSetting"]] + command_line_arguments=None, # type: Optional[str] + show_in_portal=None, # type: Optional[bool] + icon_path=None, # type: Optional[str] + icon_index=None, # type: Optional[int] + **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 tags: tags to be updated. + :type tags: object + :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. + :type command_line_setting: str or ~azure.mgmt.desktopvirtualization.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 + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Application or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.Application + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Application"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _application = models.ApplicationPatch(tags=tags, description=description, friendly_name=friendly_name, file_path=file_path, command_line_setting=command_line_setting, command_line_arguments=command_line_arguments, show_in_portal=show_in_portal, icon_path=icon_path, icon_index=icon_index) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + def list( + self, + resource_group_name, # type: str + application_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: ApplicationList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ApplicationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ApplicationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_desktop_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_desktop_operations.py new file mode 100644 index 00000000000..c6ef9fbc7a8 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_desktop_operations.py @@ -0,0 +1,241 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class DesktopOperations(object): + """DesktopOperations 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: ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Desktop"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + def update( + self, + resource_group_name, # type: str + application_group_name, # type: str + desktop_name, # type: str + tags=None, # type: Optional[object] + description=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + **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 tags: tags to be updated. + :type tags: object + :param description: Description of Desktop. + :type description: str + :param friendly_name: Friendly name of Desktop. + :type friendly_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: ~azure.mgmt.desktopvirtualization.models.Desktop + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Desktop"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _desktop = models.DesktopPatch(tags=tags, description=description, friendly_name=friendly_name) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + def list( + self, + resource_group_name, # type: str + application_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: DesktopList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.DesktopList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.DesktopList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_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'] = 'application/json' + + # Construct and send request + 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('DesktopList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DesktopVirtualization/applicationGroups/{applicationGroupName}/desktops'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_host_pool_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_host_pool_operations.py new file mode 100644 index 00000000000..afd0266ad4a --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_host_pool_operations.py @@ -0,0 +1,500 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class HostPoolOperations(object): + """HostPoolOperations 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: ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPool"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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'] = 'application/json' + + # Construct and send request + 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}'} + + def create_or_update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + location, # type: str + host_pool_type, # type: Union[str, "models.HostPoolType"] + personal_desktop_assignment_type, # type: Union[str, "models.PersonalDesktopAssignmentType"] + load_balancer_type, # type: Union[str, "models.LoadBalancerType"] + tags=None, # type: Optional[Dict[str, str]] + friendly_name=None, # type: Optional[str] + description=None, # type: Optional[str] + custom_rdp_property=None, # type: Optional[str] + max_session_limit=None, # type: Optional[int] + ring=None, # type: Optional[int] + validation_environment=None, # type: Optional[bool] + registration_info=None, # type: Optional["models.RegistrationInfo"] + vm_template=None, # type: Optional[str] + sso_context=None, # type: Optional[str] + **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 location: The geo-location where the resource lives. + :type location: str + :param host_pool_type: HostPool type for desktop. + :type host_pool_type: str or ~azure.mgmt.desktopvirtualization.models.HostPoolType + :param personal_desktop_assignment_type: PersonalDesktopAssignment type for HostPool. + :type personal_desktop_assignment_type: str or ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. + :type load_balancer_type: str or ~azure.mgmt.desktopvirtualization.models.LoadBalancerType + :param tags: Resource tags. + :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 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: ~azure.mgmt.desktopvirtualization.models.RegistrationInfo + :param vm_template: VM template for sessionhosts configuration within hostpool. + :type vm_template: str + :param sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: 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: ~azure.mgmt.desktopvirtualization.models.HostPool or ~azure.mgmt.desktopvirtualization.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPool"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _host_pool = models.HostPool(tags=tags, location=location, friendly_name=friendly_name, description=description, host_pool_type=host_pool_type, personal_desktop_assignment_type=personal_desktop_assignment_type, custom_rdp_property=custom_rdp_property, max_session_limit=max_session_limit, load_balancer_type=load_balancer_type, ring=ring, validation_environment=validation_environment, registration_info=registration_info, vm_template=vm_template, sso_context=sso_context) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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') + if force is not None: + query_parameters['force'] = self._serialize.query("force", force, 'bool') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + + # Construct and send request + 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}'} + + def update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + tags=None, # type: Optional[object] + friendly_name=None, # type: Optional[str] + description=None, # type: Optional[str] + custom_rdp_property=None, # type: Optional[str] + max_session_limit=None, # type: Optional[int] + personal_desktop_assignment_type=None, # type: Optional[Union[str, "models.PersonalDesktopAssignmentType"]] + load_balancer_type=None, # type: Optional[Union[str, "models.LoadBalancerType"]] + ring=None, # type: Optional[int] + validation_environment=None, # type: Optional[bool] + registration_info=None, # type: Optional["models.RegistrationInfoPatch"] + sso_context=None, # type: Optional[str] + **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 tags: tags to be updated. + :type tags: object + :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. + :type personal_desktop_assignment_type: str or ~azure.mgmt.desktopvirtualization.models.PersonalDesktopAssignmentType + :param load_balancer_type: The type of the load balancer. + :type load_balancer_type: str or ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.RegistrationInfoPatch + :param sso_context: Path to keyvault containing ssoContext secret. + :type sso_context: 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: ~azure.mgmt.desktopvirtualization.models.HostPool + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPool"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _host_pool = models.HostPoolPatch(tags=tags, friendly_name=friendly_name, description=description, custom_rdp_property=custom_rdp_property, max_session_limit=max_session_limit, personal_desktop_assignment_type=personal_desktop_assignment_type, load_balancer_type=load_balancer_type, ring=ring, validation_environment=validation_environment, registration_info=registration_info, sso_context=sso_context) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_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'] = 'application/json' + + # Construct and send request + 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}'} + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: HostPoolList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPoolList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPoolList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.HostPoolList" + """List hostPools in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: HostPoolList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.HostPoolList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.HostPoolList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_operation_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_operation_operations.py new file mode 100644 index 00000000000..74001035b6a --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_operation_operations.py @@ -0,0 +1,89 @@ +# 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 HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class OperationOperations(object): + """OperationOperations 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: ~azure.mgmt.desktopvirtualization.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: (...) -> "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: ResourceProviderOperationList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.ResourceProviderOperationList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.ResourceProviderOperationList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.list.metadata['url'] + + # 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'] = 'application/json' + + # Construct and send request + 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('ResourceProviderOperationList', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + list.metadata = {'url': '/providers/Microsoft.DesktopVirtualization/operations'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_session_host_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_session_host_operations.py new file mode 100644 index 00000000000..4c44ba9f07c --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_session_host_operations.py @@ -0,0 +1,315 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class SessionHostOperations(object): + """SessionHostOperations 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: ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SessionHost"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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] + + # Construct and send request + 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}'} + + def update( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + allow_new_session=None, # type: Optional[bool] + assigned_user=None, # type: Optional[str] + **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 allow_new_session: Allow a new session. + :type allow_new_session: bool + :param assigned_user: User assigned to SessionHost. + :type assigned_user: 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: ~azure.mgmt.desktopvirtualization.models.SessionHost + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SessionHost"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _session_host = models.SessionHostPatch(allow_new_session=allow_new_session, assigned_user=assigned_user) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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}'} + + def list( + self, + resource_group_name, # type: str + host_pool_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: SessionHostList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.SessionHostList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.SessionHostList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_start_menu_item_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_start_menu_item_operations.py new file mode 100644 index 00000000000..79ee7ce508c --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_start_menu_item_operations.py @@ -0,0 +1,117 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class StartMenuItemOperations(object): + """StartMenuItemOperations 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: ~azure.mgmt.desktopvirtualization.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: (...) -> "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: StartMenuItemList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.StartMenuItemList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.StartMenuItemList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'applicationGroupName': self._serialize.url("application_group_name", application_group_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_user_session_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_user_session_operations.py new file mode 100644 index 00000000000..f6414e431ef --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_user_session_operations.py @@ -0,0 +1,464 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class UserSessionOperations(object): + """UserSessionOperations 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: ~azure.mgmt.desktopvirtualization.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: (...) -> "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: UserSessionList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.UserSessionList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserSessionList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_host_pool.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, min_length=3), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = 'application/json' + + # Construct and send request + 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'} + + 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: ~azure.mgmt.desktopvirtualization.models.UserSession + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserSession"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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'] = 'application/json' + + # Construct and send request + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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] + + # Construct and send request + 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}'} + + def list( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: UserSessionList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.UserSessionList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.UserSessionList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.disconnect.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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] + + # Construct and send request + 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'} + + def send_message( + self, + resource_group_name, # type: str + host_pool_name, # type: str + session_host_name, # type: str + user_session_id, # type: str + message_title=None, # type: Optional[str] + message_body=None, # type: Optional[str] + **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 message_title: Title of message. + :type message_title: str + :param message_body: Body of message. + :type message_body: 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _send_message = models.SendMessage(message_title=message_title, message_body=message_body) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.send_message.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'hostPoolName': self._serialize.url("host_pool_name", host_pool_name, 'str', max_length=24, 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') + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_workspace_operations.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_workspace_operations.py new file mode 100644 index 00000000000..d07387f0de1 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/operations/_workspace_operations.py @@ -0,0 +1,447 @@ +# 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 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 + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class WorkspaceOperations(object): + """WorkspaceOperations 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: ~azure.mgmt.desktopvirtualization.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: ~azure.mgmt.desktopvirtualization.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workspace"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.get.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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'] = 'application/json' + + # Construct and send request + 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}'} + + def create_or_update( + self, + resource_group_name, # type: str + workspace_name, # type: str + location, # type: str + tags=None, # type: Optional[Dict[str, str]] + description=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + application_group_references=None, # type: Optional[List[str]] + **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 location: The geo-location where the resource lives. + :type location: str + :param tags: Resource tags. + :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 resource Ids. + :type application_group_references: list[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: ~azure.mgmt.desktopvirtualization.models.Workspace or ~azure.mgmt.desktopvirtualization.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workspace"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _workspace = models.Workspace(tags=tags, location=location, description=description, friendly_name=friendly_name, application_group_references=application_group_references) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.create_or_update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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'] = 'application/json' + + # Construct and send request + 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) + + deserialized = None + 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}'} + + 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 = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + # Construct URL + url = self.delete.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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] + + # Construct and send request + 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}'} + + def update( + self, + resource_group_name, # type: str + workspace_name, # type: str + tags=None, # type: Optional[object] + description=None, # type: Optional[str] + friendly_name=None, # type: Optional[str] + application_group_references=None, # type: Optional[List[str]] + **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 tags: tags to be updated. + :type tags: object + :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] + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Workspace or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.Workspace + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.Workspace"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + + _workspace = models.WorkspacePatch(tags=tags, description=description, friendly_name=friendly_name, application_group_references=application_group_references) + api_version = "2019-12-10-preview" + content_type = kwargs.pop("content_type", "application/json") + + # Construct URL + url = self.update.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + 'workspaceName': self._serialize.url("workspace_name", workspace_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'] = 'application/json' + + # Construct and send request + 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}'} + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "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: WorkspaceList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.WorkspaceList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkspaceList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] + 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, pattern=r'^[-\w\._\(\)]+$'), + } + url = self._client.format_url(url, **path_format_arguments) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> "models.WorkspaceList" + """List workspaces in subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: WorkspaceList or the result of cls(response) + :rtype: ~azure.mgmt.desktopvirtualization.models.WorkspaceList + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["models.WorkspaceList"] + error_map = kwargs.pop('error_map', {404: ResourceNotFoundError, 409: ResourceExistsError}) + api_version = "2019-12-10-preview" + + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] + 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) + else: + url = next_link + + # 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'] = 'application/json' + + # Construct and send request + 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'} diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/py.typed b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/py.typed new file mode 100644 index 00000000000..e5aff4f83af --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/setup.py b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/setup.py new file mode 100644 index 00000000000..52fc353a0b1 --- /dev/null +++ b/src/desktopvirtualization/azext_desktopvirtualization/vendored_sdks/desktopvirtualization/setup.py @@ -0,0 +1,37 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# coding: utf-8 + +from setuptools import setup, find_packages + +NAME = "desktopvirtualizationapiclient" +VERSION = "0.2.0" + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools + +REQUIRES = ["msrest>=0.6.0", "azure-core<2.0.0,>=1.2.0"] + +setup( + name=NAME, + version=VERSION, + description="DesktopVirtualizationAPIClient", + author_email="", + url="", + keywords=["Swagger", "DesktopVirtualizationAPIClient"], + install_requires=REQUIRES, + packages=find_packages(), + include_package_data=True, + long_description="""\ + DesktopVirtualizationAPIClient. + """ +) diff --git a/src/desktopvirtualization/report.md b/src/desktopvirtualization/report.md new file mode 100644 index 00000000000..72180f202e8 --- /dev/null +++ b/src/desktopvirtualization/report.md @@ -0,0 +1,164 @@ +# Azure CLI Module Creation Report + +### desktopvirtualization applicationgroup create + +create a desktopvirtualization applicationgroup. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--application-group-name**|string|The name of the application group|application_group_name| +|**--location**|string|The geo-location where the resource lives|location| +|**--host-pool-arm-path**|string|HostPool arm path of ApplicationGroup.|host_pool_arm_path| +|**--application-group-type**|choice|Resource Type of ApplicationGroup.|application_group_type| +|**--tags**|dictionary|Resource tags.|tags| +|**--description**|string|Description of ApplicationGroup.|description| +|**--friendly-name**|string|Friendly name of ApplicationGroup.|friendly_name| +### desktopvirtualization applicationgroup delete + +delete a desktopvirtualization applicationgroup. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--application-group-name**|string|The name of the application group|application_group_name| +### desktopvirtualization applicationgroup list + +list a desktopvirtualization applicationgroup. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--filter**|string|OData filter expression. Valid properties for filtering are applicationGroupType.|filter| +### desktopvirtualization applicationgroup show + +show a desktopvirtualization applicationgroup. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--application-group-name**|string|The name of the application group|application_group_name| +### desktopvirtualization applicationgroup update + +update a desktopvirtualization applicationgroup. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--application-group-name**|string|The name of the application group|application_group_name| +|**--tags**|any|tags to be updated|tags| +|**--description**|string|Description of ApplicationGroup.|description| +|**--friendly-name**|string|Friendly name of ApplicationGroup.|friendly_name| +### desktopvirtualization hostpool create + +create a desktopvirtualization hostpool. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--host-pool-name**|string|The name of the host pool within the specified resource group|host_pool_name| +|**--location**|string|The geo-location where the resource lives|location| +|**--host-pool-type**|choice|HostPool type for desktop.|host_pool_type| +|**--personal-desktop-assignment-type**|choice|PersonalDesktopAssignment type for HostPool.|personal_desktop_assignment_type| +|**--load-balancer-type**|choice|The type of the load balancer.|load_balancer_type| +|**--tags**|dictionary|Resource tags.|tags| +|**--friendly-name**|string|Friendly name of HostPool.|friendly_name| +|**--description**|string|Description of HostPool.|description| +|**--custom-rdp-property**|string|Custom rdp property of HostPool.|custom_rdp_property| +|**--max-session-limit**|integer|The max session limit of HostPool.|max_session_limit| +|**--ring**|integer|The ring number of HostPool.|ring| +|**--validation-environment**|boolean|Is validation environment.|validation_environment| +|**--registration-info**|object|The registration info of HostPool.|registration_info| +|**--vm-template**|string|VM template for sessionhosts configuration within hostpool.|vm_template| +|**--sso-context**|string|Path to keyvault containing ssoContext secret.|sso_context| +### desktopvirtualization hostpool delete + +delete a desktopvirtualization hostpool. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--host-pool-name**|string|The name of the host pool within the specified resource group|host_pool_name| +|**--force**|boolean|Force flag to delete sessionHost.|force| +### desktopvirtualization hostpool list + +list a desktopvirtualization hostpool. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +### desktopvirtualization hostpool show + +show a desktopvirtualization hostpool. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--host-pool-name**|string|The name of the host pool within the specified resource group|host_pool_name| +### desktopvirtualization hostpool update + +update a desktopvirtualization hostpool. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--host-pool-name**|string|The name of the host pool within the specified resource group|host_pool_name| +|**--tags**|any|tags to be updated|tags| +|**--friendly-name**|string|Friendly name of HostPool.|friendly_name| +|**--description**|string|Description of HostPool.|description| +|**--custom-rdp-property**|string|Custom rdp property of HostPool.|custom_rdp_property| +|**--max-session-limit**|integer|The max session limit of HostPool.|max_session_limit| +|**--personal-desktop-assignment-type**|choice|PersonalDesktopAssignment type for HostPool.|personal_desktop_assignment_type| +|**--load-balancer-type**|choice|The type of the load balancer.|load_balancer_type| +|**--ring**|integer|The ring number of HostPool.|ring| +|**--validation-environment**|boolean|Is validation environment.|validation_environment| +|**--registration-info**|object|The registration info of HostPool.|registration_info| +|**--sso-context**|string|Path to keyvault containing ssoContext secret.|sso_context| +### desktopvirtualization workspace create + +create a desktopvirtualization workspace. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace|workspace_name| +|**--location**|string|The geo-location where the resource lives|location| +|**--tags**|dictionary|Resource tags.|tags| +|**--description**|string|Description of Workspace.|description| +|**--friendly-name**|string|Friendly name of Workspace.|friendly_name| +|**--application-group-references**|array|List of applicationGroup resource Ids.|application_group_references| +### desktopvirtualization workspace delete + +delete a desktopvirtualization workspace. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace|workspace_name| +### desktopvirtualization workspace list + +list a desktopvirtualization workspace. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +### desktopvirtualization workspace show + +show a desktopvirtualization workspace. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace|workspace_name| +### desktopvirtualization workspace update + +update a desktopvirtualization workspace. + +|Option|Type|Description|Path (SDK)|Path (swagger)| +|------|----|-----------|----------|--------------| +|**--resource-group-name**|string|The name of the resource group. The name is case insensitive.|resource_group_name| +|**--workspace-name**|string|The name of the workspace|workspace_name| +|**--tags**|any|tags to be updated|tags| +|**--description**|string|Description of Workspace.|description| +|**--friendly-name**|string|Friendly name of Workspace.|friendly_name| +|**--application-group-references**|array|List of applicationGroup links.|application_group_references| \ No newline at end of file diff --git a/src/desktopvirtualization/setup.cfg b/src/desktopvirtualization/setup.cfg new file mode 100644 index 00000000000..2fdd96e5d39 --- /dev/null +++ b/src/desktopvirtualization/setup.cfg @@ -0,0 +1 @@ +#setup.cfg \ No newline at end of file diff --git a/src/desktopvirtualization/setup.py b/src/desktopvirtualization/setup.py new file mode 100644 index 00000000000..4953877b6a5 --- /dev/null +++ b/src/desktopvirtualization/setup.py @@ -0,0 +1,53 @@ +#!/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. +# -------------------------------------------------------------------------------------------- + + +from codecs import open +from setuptools import setup, find_packages + +# TODO: Confirm this is the right version number you want and it matches your +# HISTORY.rst entry. +VERSION = '0.1.0' + +# The full list of classifiers is available at +# https://pypi.python.org/pypi?%3Aaction=list_classifiers +CLASSIFIERS = [ + 'Development Status :: 4 - Beta', + 'Intended Audience :: Developers', + 'Intended Audience :: System Administrators', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'License :: OSI Approved :: MIT License', +] + +# TODO: Add any additional SDK dependencies here +DEPENDENCIES = [] + +with open('README.md', 'r', encoding='utf-8') as f: + README = f.read() +with open('HISTORY.rst', 'r', encoding='utf-8') as f: + HISTORY = f.read() + +setup( + name='desktopvirtualization', + version=VERSION, + description='Microsoft Azure Command-Line Tools DesktopVirtualizationAPIClient Extension', + # TODO: Update author and email, if applicable + author='Microsoft Corporation', + author_email='azpycli@microsoft.com', + # TODO: consider pointing directly to your source code instead of the generic repo + url='https://github.com/Azure/azure-cli-extensions', + long_description=README + '\n\n' + HISTORY, + license='MIT', + classifiers=CLASSIFIERS, + packages=find_packages(), + install_requires=DEPENDENCIES, + package_data={'azext_desktopvirtualization': ['azext_metadata.json']}, +)